How to align text in an GtkIconView ??
I can't find a way to center align the text in a GtkIconView. You can see problem only when the label take 2 line, because the second line start at the beginning of the first. Someone can help? Thanks DaveMDS ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Bug in icon_view? (gtk 2.8)
Hi , (no replay on my last post...retry...) I have a problem using the IconView auto-dnd (gtk_icon_view_enable_model_drag_source) and the item-activated signal. On item-activate I show a dialog to the user, when the dialog is closed the IconView start a drag operation incorrectly. This is the complete code (is this a bug? or I made something Wrong?) --- #include gtk/gtk.h enum { COL_TEXT, COL_PIXBUF, NUM_COLS }; static GtkTargetEntry targets[] = { { text/uri-list, 0, 0 }, }; GtkWidget *window = NULL; GtkWidget *icon_view; GtkListStore *store; static void fill_store (GtkListStore *store) { GtkTreeIter iter; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (test.png, NULL); /* First clear the store */ gtk_list_store_clear (store); gtk_list_store_append (store, iter); gtk_list_store_set (store, iter, COL_TEXT, test,COL_PIXBUF,pixbuf, -1); } static void on_item_activated(GtkIconView *iconview,GtkTreePath *arg1,gpointer user_data){ GtkWidget *dialog; g_print(ACTIVATed\n); dialog = gtk_dialog_new_with_buttons(TEST, GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CLOSE,GTK_RESPONSE_YES, NULL); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); } int main(int argc,char *argv[]){ gtk_init (argc, argv); //window window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 650, 400); gtk_window_set_title (GTK_WINDOW (window), GtkIconView demo); g_signal_connect (window, destroy,G_CALLBACK (gtk_widget_destroyed), window); //store store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF); fill_store (store); //icon_view icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store)); gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_TEXT); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF); /* enable icon view auto D'n'D */ gtk_icon_view_enable_model_drag_source(GTK_ICON_VIEW(icon_view),GDK_BUTTON1_MASK,targets,1,GDK_ACTION_COPY); gtk_icon_view_enable_model_drag_dest(GTK_ICON_VIEW(icon_view),targets,1, GDK_ACTION_COPY); gtk_signal_connect (GTK_OBJECT (icon_view), item-activated, GTK_SIGNAL_FUNC (on_item_activated),NULL); gtk_container_add (GTK_CONTAINER (window), icon_view); gtk_widget_show_all (window); gtk_main(); return 0; } -- Really thanks! Dave Andreoli ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Problem with icon_view auto dnd (gtk 2.8)
Hi , I have a problem using the IconView auto-dnd (gtk_icon_view_enable_model_drag_source) and the item-activated signal. On item-activate I show a dialog to the user, when the dialog is closed the IconView start a drag operation incorrectly. This is the complete code (is this a bug? or I made something Wrong?) --- #include gtk/gtk.h enum { COL_TEXT, COL_PIXBUF, NUM_COLS }; static GtkTargetEntry targets[] = { { text/uri-list, 0, 0 }, }; GtkWidget *window = NULL; GtkWidget *icon_view; GtkListStore *store; static void fill_store (GtkListStore *store) { GtkTreeIter iter; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (test.png, NULL); /* First clear the store */ gtk_list_store_clear (store); gtk_list_store_append (store, iter); gtk_list_store_set (store, iter, COL_TEXT, test,COL_PIXBUF,pixbuf, -1); } static void on_item_activated(GtkIconView *iconview,GtkTreePath *arg1,gpointer user_data){ GtkWidget *dialog; g_print(ACTIVATed\n); dialog = gtk_dialog_new_with_buttons(TEST, GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CLOSE,GTK_RESPONSE_YES, NULL); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); } int main(int argc,char *argv[]){ gtk_init (argc, argv); //window window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 650, 400); gtk_window_set_title (GTK_WINDOW (window), GtkIconView demo); g_signal_connect (window, destroy,G_CALLBACK (gtk_widget_destroyed), window); //store store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF); fill_store (store); //icon_view icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store)); gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_TEXT); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF); /* enable icon view auto D'n'D */ gtk_icon_view_enable_model_drag_source(GTK_ICON_VIEW(icon_view),GDK_BUTTON1_MASK,targets,1,GDK_ACTION_COPY); gtk_icon_view_enable_model_drag_dest(GTK_ICON_VIEW(icon_view),targets,1, GDK_ACTION_COPY); gtk_signal_connect (GTK_OBJECT (icon_view), item-activated, GTK_SIGNAL_FUNC (on_item_activated),NULL); gtk_container_add (GTK_CONTAINER (window), icon_view); gtk_widget_show_all (window); gtk_main(); return 0; } -- Really thanks! Dave Andreoli ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: A simple gtk app on ARM
I all, I have a problem with GtkIconView: when I try to set the width of the icons with: gtk_icon_view_set_item_width(icon_view,128); the placement of the icon become strange. If I don't touch the width all the icon are at the correct position, but if I try to enlarge some icon take 2 or more cell (like a colspan=2 in html). I can't find some decente documentation on this widget... Can someone help? Thanks DaveMDS ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list