Faking a GTK_RESPONSE_OK in a GTK dialog - gtk

I want to have a gtk_file_chooser_dialog that does not browse into a folder if it has a specific name. For this I hooked up my dialog with a callback when a current-folder-changed signal is emitted. In the callback function I successfully detect if the selected folder has the specific name. However, I can't figure out how to tell the dialog to close itself and return a specific response code (e.g. GTK_RESPONSE_OK).
I have unsuccessfully tried (among other things):
g_signal_emit_by_name(G_OBJECT(my_dialog), "response", GTK_RESPONSE_OK);
Has anyone a better idea ? I would appreciate any pointers into the right direction..
cheers

You're trying too hard. Just use:
gtk_dialog_response(GTK_DIALOG(my_dialog), GTK_RESPONSE_OK);
See the splendid documentation.

Related

MATLAB - callback excecution of edit box

As it is referenced in MATLAB documentation for edit box uicontrol or stated in this
post, when another component or menu bar or background GUI is clicked, the edit box callback gets executed. But in my attempts to use this functionality, I haven't been able so far to see the callback execution unless there is a change of edit box text or Enter key is pressed. What I'm trying to achieve is to execute edit box callback whenever there is focus loss from edit box even when nothing has been entered. Please enlighten me about what I'm missing here and how I can do this?
Thanks in advance.
The underlying Java object has a callback called FocusLostCallback that'll do what you want - execute when the object's focus is lost, even if you changed nothing.
You'll need findjobj from the MATLAB File Exchange. Then, get the Java handle and set the callback as usual (make sure the uicontrol is visible when you try to get the Java handle):
jh = findjobj(myEditBox); % myEditBox is a uicontrol handle
set(jh, 'FocusLostCallback', #myCallback);
A more complete list of the undocumented uicontrol callbacks can be found at Yair Altman's Undocumented MATLAB blog.
This method work perfectly with single-line textbox, but it has any effect with multi-line textbox (uicontrol, style edit, max = 2)

How to programmatically change help contents in Eclipse?

I have an eclipse plugin and I would like to programmatically disable help content TOC's based on a variable I define. In a nut shell, I want to prevent some help docs from showing up in the help contents if a specific type of user is accessing the plugin.
Preferably I would like to do this in the ApplicationWorkbenchAdvisor somewhere.
One thought would be to modify the "primary" value to be false if the variable were set.
Not sure if it would work, but try using the org.eclipse.ui.activities extension point. The tutorial from Vogella tells it is possible to hide only UI elements like wizards, views and so on, but it is from 2009.. Not sure if hiding TOC is now possible. If you try it out, would be nice to give a feedback ;)

avoid chrome popup extension to close

Is there a function that allow me to select text when the extension
stays open. Normally when I Use the extension popup and I Click outside the
extension the extension close. Is there a wat to avoid this.
Thank you so much
Unfortunately there is currently no way to keep the popup open once you focus out of it. This is by design.
If you would like to always show something while interacting with the page, perhaps the experimental Info bars or even Desktop Notifications would work?
Hope that helped!
The only way to keep it open is to right click over the extension icon (button) and select "Inspect popup" the extension popup then show up and remain open but of course the debugger window show and this not a fix obviously still it will maybe inspire a hack... if someone is skilled enough and share the solution with all of us.
I encountered the same problem and I've thought of a possible solution (though not tested it):
Use your background.html to store the content of the popup action and upon loading the popup, you fetch the content via the default messaging for chrome extensions.
When doing all kinds of other stuff, like XHR's or something, I think you should do that in background.html too, so the requests won't abort if you close and you can do something with the result. Then when a user re-opens the popup, he'll see the result of his previous action instead of the default screen.
Anyone tried something like did already?
As far as I know you can't persist a pop up menu but my workaround has been using a content script to append a menu on page load. After the menu is appended you can toggle the menu via messaging between the background script and the content script.
If you want to encapsulate the menu from the page it's deployed on you could wrap your menu in an iframe. This could add complexity to your project since you would have to deal with cross origin issues and permissions.
There is an alternative hack for this. You can make use of chrome local storage to store the metadata as needed. Upon restart you can read that metadata and render the desired content. You will also probably clear that metadata after you have completed performing the operations based on that.

Submit form from greybox window to main window

I'm using greybox and trying the following thing: I want to make a form inside the pop-up so when the users submit's it, the request goes to the main window and the pop-up closes.
I know the way to close the window is by using onclick="parent.parent.GB_hide()", but I really haven't been able to find a way to make the pop-up close and the data sent to the corresponding controller when the form is submitted.
I'm using Zend FW.
Thanks in advance,
I really appreciate what this community does.
Just use this code given below at the end of the loop
parent.parent.GB_hide();

How can I register OverlayIcon.dll and call it to display overlay icon on the selected file/folder?

I read this article in http://www.codeproject.com/KB/shell/overlayicon.aspx. I have some questions that I cannot answer. Please help me?
First, after I build the project. I received an OverlayIcon.dll. I used regsrv32 to register it to Windows. How can I call or do something to enable overlay icon on file?
Whether I will use other program to call functions to enable overlay function on the dll or not ?
And I want to know the location of the file/directory that will be affected by the overlay?
If I select a file and right-click on it, how can I code to enable overlay icon on it?
Please help me, I'm very grateful to you.
Thanks in advance.
You should have implemented the IShellIconOverlayIdentifier::IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib) method, that tells explorer to show (or not to) the overlay icon.
In pwszPath you have the full path of the file that is currently being analyzed, starting from there you should have all the info in order to determine if the file needs the overlay.
Just return S_OK to display the icon, or S_FALSE to avoid it.
I've successfully used that article "as is".
Be also sure that the .dll is built according to your cpu architecture.