Re: any easy way of having a YES/NO dialog return a 1 or 0?
On Tue, Jan 17, 2012 at 04:12:51PM +0900, Tristan Van Berkom wrote: Even in english, these boolean YES/NO questions can seem ambiguous, If you use wordy and convoluted questions such as Are you sure you want to quit without saving then nothing can help the poor users. Of course, they are also susceptible to mistranslation. The fix is brevity and clarity, not banning Yes and No. The question Does 2+2 equal 5? is not improved by buttons labels ‘It is five’ and ‘It is some other number’. Hence Are you sure you want to quit without saving ? Should typically have the answers: Save Quit is nonsense. This question should not occur in a sensible GUI no matter what answers are offered. Yeti ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: any easy way of having a YES/NO dialog return a 1 or 0?
2012/1/17 David Nečas y...@physics.muni.cz: On Tue, Jan 17, 2012 at 04:12:51PM +0900, Tristan Van Berkom wrote: Even in english, these boolean YES/NO questions can seem ambiguous, If you use wordy and convoluted questions such as Are you sure you want to quit without saving then nothing can help the poor users. Of course, they are also susceptible to mistranslation. The fix is brevity and clarity, not banning Yes and No. The question Does 2+2 equal 5? is not improved by buttons labels ‘It is five’ and ‘It is some other number’. When is the last time a program asked you that question in a dialog ? Hence Are you sure you want to quit without saving ? Should typically have the answers: Save Quit is nonsense. This question should not occur in a sensible GUI no matter what answers are offered. You are arguing that sensible guis should allow you to quit without warning the user that there is unsaved data ? What do you propose instead ? Are you really suggesting that we revert to unsophisticated error prone yes/no dialogs that plagued the 90s ? I think by 2012 we've learned our lessons about this. Cheers, -Tristan ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: any easy way of having a YES/NO dialog return a 1 or 0?
On Tue, 17 Jan 2012, Tristan Van Berkom wrote: 2012/1/17 David Nečas y...@physics.muni.cz: Hence Are you sure you want to quit without saving ? Should typically have the answers: Save Quit is nonsense. This question should not occur in a sensible GUI no matter what answers are offered. You are arguing that sensible guis should allow you to quit without warning the user that there is unsaved data ? What do you propose instead ? How about: Do you want to save your data? Y/N Allin Cottrell___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On 01/15/2012 12:51 AM, Gary Kline wrote: On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? exit() *does* terminate the program no matter what loop or whatever it might be running. So, most likely, you think your code calls exit() at some point but that actually never happens. The program might get stuck in the finalisation phase if some exit handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose if you were registering such things you (a) would have told us (b) did not wonder what happened. Yeti P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. Normally one calls gtk_main_quit() and the program continues execution after gtk_main() ??? which typically means it then reaches the end of main() and terminates. you were abs correct about exit(). i moved it around and was able to verify that my code was doing what i had thought. that puts me back to the problem of my gtk application going dark/dim; This usually indicates that an application is busy. Run the app inside gdb, break into gdb when it is gray and check the backtrace. Stefan it looks like this may be a feature of ubuntu linux. i've posted to unubtuforums and waiting. --at any rate, thanks for your help. gary ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
FileChooserButton set_filename doesn't work as expected
Hi, all! I have small gtk2-perl application where I try to change currently selected file name of FileChooserButton widget. Everything going fine, set_filename returns TRUE, until I have changed file name manually opening dialog. Does'nt matter what I selecting in dialog. After that I can't change file name programmatically and set_filename method always sets caption as '(None)', returns FALSE inspite of neccessary file exists and was successfully used for this purpose before. Can anybody help me with this issue? What I am doing wrong? -- Truly yours, Oleg Ivanenko [if it wasn't so sad, it would be funny] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Re : Iconview stock items
Le 17/01/2012 02:02, Neil Munro a écrit : On 16 January 2012 19:01, Nicolas SOUBEIRANnicolas.soubei...@gmail.com wrote: Use gtk_widget_render_icon_pixbuf If you need a custom size, you may look after gtk_icon_size_register Is this a gtk3 function as I cannot find it as a function of a gtk2 widget: http://www.gtk.org/api/2.6/gtk/GtkWidget.html It is a gtk3 function the gtk2 equivalent is gtk_widget_render_icon : http://www.gtk.org/api/2.6/gtk/GtkWidget.html#gtk-widget-render-icon ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Re : Iconview stock items
On 17 January 2012 18:20, Nicolas SOUBEIRAN nicolas.soubei...@gmail.com wrote: Le 17/01/2012 02:02, Neil Munro a écrit : On 16 January 2012 19:01, Nicolas SOUBEIRANnicolas.soubei...@gmail.com wrote: Use gtk_widget_render_icon_pixbuf If you need a custom size, you may look after gtk_icon_size_register Is this a gtk3 function as I cannot find it as a function of a gtk2 widget: http://www.gtk.org/api/2.6/gtk/GtkWidget.html It is a gtk3 function the gtk2 equivalent is gtk_widget_render_icon : http://www.gtk.org/api/2.6/gtk/GtkWidget.html#gtk-widget-render-icon Excellent, however I am still stuck, if this function returns a pixbuf and I pass it the stock_id and size I want, what widget do I need to pass to it? Also what purpose does the detail parameter serve? I thought I was coming to understand gtk+ until now, I am sure that what I am trying to achieve is a trivial matter (I am ultimately creating a iconview to essentially be a prettier way to navigate about a notebook) but for some reason I am just getting stuck. Again if anyone could offer any help I would be really grateful ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTreeView row color with CSS
How can I change the unselected row color in a GtkTreeView using CSS in Gtk3? I've tried even-row-color, -GtkWidget-even-row-color and GtkTreeView row:nth-child(even) /* COMPILE WITH: gcc -Wall -o tree1 `pkg-config --cflags --libs gtk+-3.0` tree1.c */ #include gtk/gtk.h enum { LIST_ITEM = 0, N_COLUMNS }; static void init_list(GtkWidget *list) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; / CSS */ GtkCssProvider *provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, GtkTreeView {\n -GtkWidget-even-row-color: green;\n color: white;\n }\n, -1, NULL); GdkDisplay *display = gdk_display_get_default (); GdkScreen *screen = gdk_display_get_default_screen (display); gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); /*/ renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(List Items, renderer, text, LIST_ITEM, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(list), GTK_TREE_MODEL(store)); g_object_unref(store); } static void add_to_list(GtkWidget *list, const gchar *str) { GtkListStore *store; GtkTreeIter iter; store = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(list))); gtk_list_store_append(store, iter); gtk_list_store_set(store, iter, LIST_ITEM, str, -1); } void on_changed(GtkWidget *widget, gpointer label) { GtkTreeIter iter; GtkTreeModel *model; char *value; if (gtk_tree_selection_get_selected( GTK_TREE_SELECTION(widget), model, iter)) { gtk_tree_model_get(model, iter, LIST_ITEM, value, -1); gtk_label_set_text(GTK_LABEL(label), value); g_free(value); } } int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *list; GtkWidget *vbox; GtkWidget *label; GtkTreeSelection *selection; gtk_init(argc, argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(window), 10); gtk_widget_set_size_request(window, 270, 250); gtk_window_set_title(GTK_WINDOW(window), List View); list = gtk_tree_view_new(); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE); vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 5); label = gtk_label_new(); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); gtk_container_add(GTK_CONTAINER(window), vbox); init_list(list); add_to_list(list, First); add_to_list(list, Second); add_to_list(list, Third); add_to_list(list, Fourth); add_to_list(list, Fifth); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); g_signal_connect(selection, changed, G_CALLBACK(on_changed), label); g_signal_connect(G_OBJECT (window), destroy, G_CALLBACK(gtk_main_quit), NULL); gtk_widget_show_all(window); gtk_main (); return 0; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On Tue, Jan 17, 2012 at 04:34:32PM +0100, Stefan Sauer wrote: Date: Tue, 17 Jan 2012 16:34:32 +0100 From: Stefan Sauer enso...@hora-obscura.de Subject: Re: is thaere a way to exit(1)? To: gtk-app-devel-list@gnome.org On 01/15/2012 12:51 AM, Gary Kline wrote: On Fri, Jan 13, 2012 at 10:09:43PM +0100, David Ne??as wrote: On Fri, Jan 13, 2012 at 11:59:45AM -0800, Gary Kline wrote: I finally know =where= i want to exit my gtk program, but exit just doesn't break me out of my while() loop. what's the magin? exit() *does* terminate the program no matter what loop or whatever it might be running. So, most likely, you think your code calls exit() at some point but that actually never happens. The program might get stuck in the finalisation phase if some exit handler (e.g. atexit()-registered) or finaliser gets stuck but I suppose if you were registering such things you (a) would have told us (b) did not wonder what happened. Yeti P.S.: Calling exit() while within the Gtk+ main loop is a bit harsh. Normally one calls gtk_main_quit() and the program continues execution after gtk_main() ??? which typically means it then reaches the end of main() and terminates. you were abs correct about exit(). i moved it around and was able to verify that my code was doing what i had thought. that puts me back to the problem of my gtk application going dark/dim; This usually indicates that an application is busy. Run the app inside gdb, break into gdb when it is gray and check the backtrace. Stefan well, it =is= busy. it's looping endlessly; but then i limited it to 5 loops with a for-loop. same. (i thought my programming skills were better that having to use the debugger, but may have to.) before, i am going to scp everything over to my eee-900a that runs debian. see if it runs there. i hope i don't see smoke rising from the netbook :-) gary -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.57a release of Jottings: http://jottings.thought.org Twenty-five years of service to the Unix community. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: is thaere a way to exit(1)?
On 01/17/2012 03:35 PM, Gary Kline wrote: well, it =is= busy. it's looping endlessly; but then i limited it to 5 loops with a for-loop. same. (i thought my programming skills were better that having to use the debugger, but may have to.) before, i am going to scp everything over to my eee-900a that runs debian. see if it runs there. i hope i don't see smoke rising from the netbook :-) I think the problem is you are approaching your problem from a traditional, procedural point of view. That isn't going to work in event-driven apps, which is what GTK apps are. If in your code you are looping endlessly, you are preventing GTK from handling events. This means that no X11 events (mouse, keyboard, etc) are processed. Your window manager detects this and makes your app turn gray which signifies to the user that the app is hung (not responding to input). If you need to do a long-running task in GTK, either spawn a thread to do the work, allowing control of the main thread to return to GTK's main loop, or during your loop you have to iterate the GTK main event loop by doing something like this in your code: while (gtk_events_pending ()) { gtk_main_iteration (); } In general, in a callback you must return control to GTK asap for the GUI to keep running. Hope this helps. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list