Eric,
Why am I breaking the design?
Is it illegal to do?
Thank you.
On Sep 24, 2017 7:17 PM, <cecashon@xxxxxxx> wrote:
Igor,
It sounds like you are determined to hack at this. I would recommend the newer GtkFontChooserWidget but OK. The PangoFcFamily* isn't much help. You need to get your widget pointers and setup up callbacks on your treeviews. Maybe all you need is to connect a "row-activated" to know if the user clicked on a row. To do this you need to find your pointers. If you use gtk_container_forall() you can find them. When doing this you are breaking the design of the font selection widget. It is poor practice. It might be just what you need though.
Eric
/*
gcc -Wall font_selection2.c -o font_selection2 `pkg-config --cflags --libs gtk+-2.0`
gcc -Wall font_selection2.c -o font_selection2 `pkg-config --cflags --libs gtk+-3.0`
Tested with GTK3.18 on Ubuntu16.04
*/
#include<gtk/gtk.h>
static void find_widgets(GtkWidget* widget, gint *count)
{
const char *name = gtk_widget_get_name(widget);
printf("% *d. %s\n", (*count)*2, *count, name);
//Recursive call for each container widget in the file chooser dialog.
if(GTK_IS_CONTAINER(widget))
{
(*count)++;
gtk_container_foreach(GTK_CONTAINER(widget), (GtkCallback)find_widgets, count);
(*count)--;
}
}
int main(int argc, char *argv[])
{
gtk_init (&argc, &argv);
GtkWidget *window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Font Selecton");
gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkWidget *m_fontPanel=gtk_font_selection_new();
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_container_add(GTK_CONTAINER(window), m_fontPanel);
gtk_widget_show_all(window);
gint count=0;
gtk_container_forall(GTK_CONTAINER(m_fontPanel), (GtkCallback)find_widgets, &count);
gtk_main();
return 0;
}
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list