Re: That reminds me -- is there a signal that can be used when mouse over mainwin titlebar?

2018-10-04 Thread Germán Poo-Caamaño
On Wed, 2018-09-26 at 18:52 -0500, David C. Rankin wrote:
> All,
> 
> Thanks to the other "is there a signal?" question, that reminded me I
> have been looking for a signal (or way) to detect when the user has
> the mouse over  the titlebar of the main window in an editor where I
> would like to activate a tooltip showing the absolute path for the
> file in the currently focused textview. I just cannot find a signal
> or event window scheme to do it
> --
> probably because the main window titlebar is owned by the window
> manager and not the application. But still, I see other editors that
> are capable of this.
> 
>   Is there any such signal, or something that can be used in
> conjunction with
> the set_window_title call that would also provide a tooltip on
> mouseover I could respond to?

In the specific case of Client Side Decorations (CSD), like in Gnome,
applications can use GtkHeaderBar, where you can set a tooltip.

In Evince we do that for a similar use case you mention. A GtkHeaderBar
can have a title and subtitle. In the subtitle we present the filename
(basename), but you can get the full path through the tooltip.

-- 
Germán Poo-Caamaño
http://calcifer.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: State actions and Glade

2018-10-04 Thread Eric Cashon via gtk-app-devel-list
 
"I am not sure what you mean"

I don't have a good answer for this. I see that GtkRadioToolButton is in the 
list of Known Implementations for GtkActionable but doesn't use the GAction 
interface directly.

https://developer.gnome.org/gtk3/stable/GtkActionable.html#gtk-actionable-set-detailed-action-name

It looks like this allows you to set up your action groups and callbacks with 
GIO but I don't have experience with it. Maybe someone has an example of 
setting up widgets to use action callbacks?

Eric

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: State actions and Glade

2018-10-04 Thread Mitko Haralanov via gtk-app-devel-list
Hi,

Thank you for your reply. I am not sure what you mean by "GtkToolbar
doesn't implement the GAction interface". In Glade, I can define the
specify the "Action Name" for each individual widget in the Toolbar. Those
action names get automatically linked to the actions that I've defined in
the my GActionEntry array. The only thing that does not work are the Radio
button actions.

Thank you,
Mitko

On Tue, Oct 2, 2018 at 4:19 PM  wrote:

>
> Hi Mitko,
>
> The GtkToolbar doesn't implement the GAction interface so you are out of
> luck there.
>
> You can use gtk_toggle_tool_button_get_active() to get the state of one of
> the GtkRadioToolButton's in the toolbar.
>
> Eric
>
>
> //gcc -Wall toolbar1.c -o toolbar1 `pkg-config --cflags --libs gtk+-3.0`
>
> #include
>
> static void get_active_radio(GtkWidget *button, GtkToolItem **radios)
>   {
> gint i=0;
>
> for(i=0;i<3;i++)
>  {
>
> if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(radios[i])))
>   {
> g_print("radio%i\n", i+1);
>   }
>  }
>   }
> int main(int argc, char **argv)
>   {
> gtk_init(, );
>
> GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title(GTK_WINDOW(window), "Toolbar");
> gtk_window_set_default_size(GTK_WINDOW(window), 300, 100);
> gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
> g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>
> GtkToolItem *radio1=gtk_radio_tool_button_new(NULL);
> gtk_tool_item_set_expand(radio1, TRUE);
> gtk_tool_button_set_label(GTK_TOOL_BUTTON(radio1), "radio1");
> GtkToolItem
> *radio2=gtk_radio_tool_button_new_from_widget(GTK_RADIO_TOOL_BUTTON(radio1));
> gtk_tool_item_set_expand(radio2, TRUE);
> gtk_tool_button_set_label(GTK_TOOL_BUTTON(radio2), "radio2");
> GtkToolItem
> *radio3=gtk_radio_tool_button_new_from_widget(GTK_RADIO_TOOL_BUTTON(radio1));
> gtk_tool_item_set_expand(radio3, TRUE);
> gtk_tool_button_set_label(GTK_TOOL_BUTTON(radio3), "radio3");
>
> GtkWidget *toolbar=gtk_toolbar_new();
> gtk_widget_set_hexpand(toolbar, TRUE);
> gtk_toolbar_insert(GTK_TOOLBAR(toolbar), radio1, 0);
> gtk_toolbar_insert(GTK_TOOLBAR(toolbar), radio2, 1);
> gtk_toolbar_insert(GTK_TOOLBAR(toolbar), radio3, 2);
>
> GtkWidget *button=gtk_button_new_with_label("Get Active Radio");
> gtk_widget_set_hexpand(button, TRUE);
> gtk_widget_set_vexpand(button, TRUE);
> GtkToolItem *radios[]={radio1, radio2, radio3};
> g_signal_connect(button, "clicked", G_CALLBACK(get_active_radio),
> radios);
>
> GtkWidget *grid1=gtk_grid_new();
> gtk_container_set_border_width(GTK_CONTAINER(grid1), 15);
> gtk_grid_set_row_spacing(GTK_GRID(grid1), 8);
> gtk_grid_attach(GTK_GRID(grid1), toolbar, 0, 0, 1, 1);
> gtk_grid_attach(GTK_GRID(grid1), button, 0, 1, 1, 1);
>
> gtk_container_add(GTK_CONTAINER(window), grid1);
>
> gtk_widget_show_all(window);
>
> gtk_widget_grab_focus(button);
>
> gtk_main();
>
> return 0;
>   }
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list