How to track down in which application is signal handler defined gtk/gtkmm for some button - gtk3

The problem:
You wanna contribute to the some gnome/gtk/gtkmm project since you've noticed and know a way that things could be made better / you wanna fix some bug. Here are steps to get you started.
Example problem:
"Clean" button in Gnome Builder isn't doing anything to my project and since at this point I believe it is just empty function with placeholder button I wanna implement actual action.

Here are steps:
open application that you wanna modify in terminal where environment GTK_DEBUG=interactive environment variable is set. so run GTK_DEBUG=interactive gnome-builder
Gtk inspector should have opened and you should see bunch of Objects displayed. If you click on Object in inspector, that object should light up in your application
Gtk has clear hierarchy, so parent contains children, and your job is to detect in which parent is child that you want to modify
When you figure which parent you want click on arrow next to the name of that parent to reveal its children
Repeat steps 3. and 4. by applying 2. to get to the child that you want to modify
For example my path is IdePrimaryWorkspace -> GtkPopover -> GtkBox -> DzlPriorityBox -> GbpBuilduiOmniBarSection -> GtkBox -> GtkBox -> GtkButton
Double click last interactive entry (such as GtkButton
on the left, in drop-down switch to Properties view
find property that you want, mine is GtkActionable, and it's value is builder-manager.clean
open source folder in terminal of application that you are interested in (clone source of that application)
type in command tree | grep build-manager
if there are entries with that filename type in find . --name=filenameof.your.file
get file path, open that file in text editor/IDE, change stuff inside
submit patches

Related

VsCode extension. How to select a tree view item on right click

I am writitng a VsCode extension. When the user Right Clicks on an item in the tree view, he gets the popup command, whose actions apply to the previously selected item. In VsCode itself, this isn't the case. RightCliking on New File, for instance, adds a file to the currently highlighted folder (Not the selected one). How can I replicate this behavior in my extensions?
I found the solution.
When registering the command, which the right-click runs, add a parameter which is the Tree Node. When the command is invoked via the menu popup, this tree node will be the highlighted node, and not the selected node.
For example replace the code
commands.registerCommand('myExtension.myCommand', () => this.command());
and later on:
command() {
}
with
commands.registerCommand('myExtension.myCommand', command(), this);
and later on:
command(node: TreeNode) {
if (node) {
}
}
The if (node) is necessary, if the command may be invoked from a different context (like a button), in which case node would be undefined.

Eclipse ui: retrieving the first visible line of an editor

In the Eclipse UI, I'd like to set the visible area in an editor. In other words, if the number of lines of my file is larger than the number of lines my editor can show then I want to specify the first shown line. My first approach was to calculate the first visible line via the selection value of its vertical scroll bar. The following link points to my initial question. Its answer explains how to set the first visible line in an editor.
eclipse ui: setting scrollbar but editor does not follow
The problem now is that my initial way of retrieving the first visible line in an editor fails in some cases: Although I verify that the active page is indeed an editor, the focus might be assigned to another page. In such a case, the following code yields the ScrollBar of a different page:
public static void update(final IWorkbenchWindow w)
final Scrollable scrollable =
(Scrollable) w.getWorkbench().getDisplay().getFocusControl();
final ScrollBar vScrollBar = scrollable.getVerticalBar();
So, my question: If editor is the reference of an active editor (ITextEditor and IReusableEditor), how to I get its first visible line?
If you can access the editor ITextViewer or its extension ISourceViewer (usually implemented by the SourceViewer or TextViewer class) you can call the ITextViewer.getTopIndex() method to get the top line index.
If your editor is derived from AbstractTextEditor (or one of its subclasses such as TextEditor) there is a protected method getSourceViewer() that returns this. You may have to add a public method if you want to access this from outside of the editor.

Access debug variables from within the code

It's about debugging in eclipse,
While debugging, I can see Variables window containing the variable names and their values, how can I access those variables and get their values from within the code or (expression) window?
For example can I write something like this:
print cash.dbname
or
x=cr.IN_MAX
or
s = _pool._serialized
(See the picture)
There's a very complex tree of variables, can I also access this variable tree reaching the branches and leaves?
Open the Display view; there you can enter code snippets that execute within the current stack frame selected in the Debug view. Code completion works, too.
You can select part or all of the contents of the Display view, right-click, and choose to Display, Inspect, or Execute it. Very powerful for exploring application state when debugging.
See also the Eclipse Help page about Display View.

GWT : cell tree and initial keyboard selected node

I'm using a CellTree with the KeyboardSelectionPolicy.BOUND_TO_SELECTION.
I'd like to open the tree with a given path selected.
The code opening the child path and selecting the node is working fine when KeyboardSelectionPolicy is ENABLED/DISABLED but when BOUND_TO_SELECTION I can see that the keyboard-selected-node in the tree is never updated from : cellTree.selectionModel.setSelected( ... )
So I'm wondering if setSelected can work with BOUND_TO_SELECTION and how to do it.
See http://code.google.com/p/google-web-toolkit/issues/detail?id=6310
I suppose you could find a way to call setKeyboardSelectedRow in response to SelectionChangeEvents.

open and play a scene in Unity3d

I have done a project with many scenes in Unity3D.
In the first scene there are buttons, each of them will play a scene when clicked.
For example, if the player clicks the button “Show the balloon”, then the scene called Balloon (which contains a balloon object and its animation) will be opened.
How can I do it using JavaScript code?
See Application.LoadLevel(...).
From the documentation:
[...]. Before you can load a level you have to add it to the list of levels
used in the game. [...]
// Loads the level with index 0
Application.LoadLevel (0);
// Load the level named "HighScore".
Application.LoadLevel ("HighScore");
First thing you have to do is add all the levels you want into the Build Settings Property.
Go to Unity or File Menu, Build Settings, and drag and drop your scenes into the scroll window. Then it'll assign them a logical number (or you can reference by name).
Application.LoadLevel(0); // this loads the first level in the list
Application.LoadLevel("nameoflevel"); //does the same thing numerically except by name
Application.LoadLevel(Application.loadedLevel); //reloads current level
Application.LoadLevel(Application.loadedLevel + 1); //loads the next level in order
Application.LoadLevel(Application.loadedLevel - 1); //loads the prior level in order
Application.LoadLevel(Application.levelCount - 1); //loads the last level in list
The int version of LoadLevel takes the id from build settings.
You can also call the string version, which takes the scene name from the project view (Though it still has to be in build settings for it to be found)
Go to File->Build Settings and drag your scenes there then use following.
Application.LoadLevel("Ballon");
If you want to reload the current level, you can use
Application.LoadLevel (Application.loadedLevel);
You'll, of course, need to make sure to manually reset or destroy anything that was created by the scene and marked as DontDestroyOnLoad.
And yes, the only way to put levels in any order in your build is from the build settings menu. You can jump around to which level is loaded by specifying its name or build order, but if you wanted to insert your levels in order in the build sequence and just want to jump from one level to the next (ie, Menu->Level1->Level2->EndGame), you can use
Application.LoadLevel (Application.loadedLevel + 1);