diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-06-19 21:59:15 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-06-19 21:59:15 -0400 |
commit | 0a601b093c151d4f8d7383b5acb4312af9f75c1d (patch) | |
tree | 3fa317182b773442613251b5a408a7b7c549b1b3 /demos | |
parent | 2f8e4f2685a38d92bfb7b03159bc2640f6eff011 (diff) | |
download | gtk+-0a601b093c151d4f8d7383b5acb4312af9f75c1d.tar.gz |
gtk-demo: Many cosmetic fixes
Mostly update window titles, and some addition to descriptions.
Diffstat (limited to 'demos')
36 files changed, 193 insertions, 168 deletions
diff --git a/demos/gtk-demo/builder.c b/demos/gtk-demo/builder.c index ee25820d1c..33c86ac5d4 100644 --- a/demos/gtk-demo/builder.c +++ b/demos/gtk-demo/builder.c @@ -48,7 +48,6 @@ GtkWidget * do_builder (GtkWidget *do_widget) { static GtkWidget *window = NULL; - GError *err = NULL; GtkWidget *toolbar; GActionGroup *actions; GtkAccelGroup *accel_group; @@ -56,13 +55,8 @@ do_builder (GtkWidget *do_widget) if (!window) { - builder = gtk_builder_new (); - gtk_builder_add_from_resource (builder, "/builder/demo.ui", &err); - if (err) - { - g_error ("ERROR: %s\n", err->message); - return NULL; - } + builder = gtk_builder_new_from_resource ("/builder/demo.ui"); + gtk_builder_connect_signals (builder, NULL); window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); gtk_window_set_screen (GTK_WINDOW (window), diff --git a/demos/gtk-demo/button_box.c b/demos/gtk-demo/button_box.c index 18e797029f..c99bbb79dd 100644 --- a/demos/gtk-demo/button_box.c +++ b/demos/gtk-demo/button_box.c @@ -56,7 +56,7 @@ do_button_box (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Button Boxes"); + gtk_window_set_title (GTK_WINDOW (window), "Button Boxes demo"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c index 445af3fa94..6edcb25a14 100644 --- a/demos/gtk-demo/changedisplay.c +++ b/demos/gtk-demo/changedisplay.c @@ -242,7 +242,7 @@ open_display_cb (GtkWidget *button, if (!result) { gchar *error_msg = - g_strdup_printf ("Can't open display :\n\t%s\nplease try another one\n", + g_strdup_printf ("Can't open display:\n\t%s\nplease try another one\n", new_screen_name); gtk_label_set_text (GTK_LABEL (dialog_label), error_msg); g_free (error_msg); @@ -523,12 +523,12 @@ do_changedisplay (GtkWidget *do_widget) info = g_new0 (ChangeDisplayInfo, 1); - info->window = gtk_dialog_new_with_buttons ("Change Screen or display", - GTK_WINDOW (do_widget), - 0, - _("_Close"), GTK_RESPONSE_CLOSE, - "Change", GTK_RESPONSE_OK, - NULL); + info->window = gtk_dialog_new_with_buttons ("Change Display", + GTK_WINDOW (do_widget), + 0, + "Close", GTK_RESPONSE_CLOSE, + "Change", GTK_RESPONSE_OK, + NULL); gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400); diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c index 378a77fd40..e4b882e57a 100644 --- a/demos/gtk-demo/clipboard.c +++ b/demos/gtk-demo/clipboard.c @@ -213,7 +213,7 @@ do_clipboard (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo"); + gtk_window_set_title (GTK_WINDOW (window), "Clipboard"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c index f78ee82422..dec9a0636a 100644 --- a/demos/gtk-demo/combobox.c +++ b/demos/gtk-demo/combobox.c @@ -318,7 +318,7 @@ do_combobox (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Combo boxes"); + gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c index df5e14b9a3..8c3dae70ef 100644 --- a/demos/gtk-demo/css_accordion.c +++ b/demos/gtk-demo/css_accordion.c @@ -23,16 +23,14 @@ do_css_accordion (GtkWidget *do_widget) { GtkWidget *container, *child; GtkStyleProvider *provider; - GBytes *bytes; - gsize data_size; - const guint8 *data; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 600, 300); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); - + container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign (container, GTK_ALIGN_CENTER); gtk_widget_set_valign (container, GTK_ALIGN_CENTER); @@ -57,11 +55,7 @@ do_css_accordion (GtkWidget *do_widget) gtk_container_add (GTK_CONTAINER (container), child); provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); - bytes = g_resources_lookup_data ("/css_accordion/css_accordion.css", 0, NULL); - data = g_bytes_get_data (bytes, &data_size); - - gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), (gchar *)data, data_size, NULL); - g_bytes_unref (bytes); + gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css"); apply_css (window, provider); } diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c index 04c4ee3b90..6bc245fe9e 100644 --- a/demos/gtk-demo/css_basics.c +++ b/demos/gtk-demo/css_basics.c @@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider, gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end); } - + static void css_text_changed (GtkTextBuffer *buffer, GtkCssProvider *provider) @@ -70,8 +70,9 @@ do_css_basics (GtkWidget *do_widget) GtkStyleProvider *provider; GtkTextBuffer *text; GBytes *bytes; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "CSS Basics"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); g_signal_connect (window, "destroy", @@ -88,15 +89,13 @@ do_css_basics (GtkWidget *do_widget) NULL); provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); - + container = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (window), container); child = gtk_text_view_new_with_buffer (text); gtk_container_add (GTK_CONTAINER (container), child); - g_signal_connect (text, - "changed", - G_CALLBACK (css_text_changed), - provider); + g_signal_connect (text, "changed", + G_CALLBACK (css_text_changed), provider); bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL); gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes)); diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c index e69ce7784a..c10a5cac63 100644 --- a/demos/gtk-demo/css_multiplebgs.c +++ b/demos/gtk-demo/css_multiplebgs.c @@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider, gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end); } - + static void css_text_changed (GtkTextBuffer *buffer, GtkCssProvider *provider) @@ -90,6 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget) GBytes *bytes; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); g_signal_connect (window, "destroy", diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c index fabcc5d161..360c0d5049 100644 --- a/demos/gtk-demo/css_pixbufs.c +++ b/demos/gtk-demo/css_pixbufs.c @@ -33,7 +33,7 @@ show_parsing_error (GtkCssProvider *provider, gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end); } - + static void css_text_changed (GtkTextBuffer *buffer, GtkCssProvider *provider) @@ -69,8 +69,9 @@ do_css_pixbufs (GtkWidget *do_widget) GtkStyleProvider *provider; GtkTextBuffer *text; GBytes *bytes; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); g_signal_connect (window, "destroy", diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c index 590c0f3f00..a4b5497174 100644 --- a/demos/gtk-demo/css_shadows.c +++ b/demos/gtk-demo/css_shadows.c @@ -32,7 +32,7 @@ show_parsing_error (GtkCssProvider *provider, gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end); } - + static void css_text_changed (GtkTextBuffer *buffer, GtkCssProvider *provider) @@ -92,8 +92,9 @@ do_css_shadows (GtkWidget *do_widget) GtkStyleProvider *provider; GtkTextBuffer *text; GBytes *bytes; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Shadows"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); g_signal_connect (window, "destroy", diff --git a/demos/gtk-demo/demo.ui b/demos/gtk-demo/demo.ui index 4bfa641edf..6a014ca52a 100644 --- a/demos/gtk-demo/demo.ui +++ b/demos/gtk-demo/demo.ui @@ -24,7 +24,7 @@ </data> </object> <object class="GtkAboutDialog" id="aboutdialog1"> - <property name="program-name" translatable="yes">GtkBuilder demo</property> + <property name="program-name" translatable="yes">Builder demo</property> <property name="logo-icon-name" translatable="yes">gtk3-demo</property> <accessibility> <relation target="window1" type="subwindow-of"/> @@ -33,7 +33,7 @@ <object class="GtkWindow" id="window1"> <property name="default_height">250</property> <property name="default_width">440</property> - <property name="title">GtkBuilder demo</property> + <property name="title" translatable="yes">Builder</property> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c index 209fd6da3d..081bbe38f4 100644 --- a/demos/gtk-demo/dialog.c +++ b/demos/gtk-demo/dialog.c @@ -1,4 +1,4 @@ -/* Dialog and Message Boxes +/* Dialogs and Message Boxes * * Dialog widgets are used to pop up a transient window for user feedback. */ @@ -109,7 +109,7 @@ do_dialog (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Dialogs"); + gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_container_set_border_width (GTK_CONTAINER (window), 8); diff --git a/demos/gtk-demo/editable_cells.c b/demos/gtk-demo/editable_cells.c index 717bf50fdc..dd8a970d66 100644 --- a/demos/gtk-demo/editable_cells.c +++ b/demos/gtk-demo/editable_cells.c @@ -349,7 +349,7 @@ do_editable_cells (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Shopping list"); + gtk_window_set_title (GTK_WINDOW (window), "Editable Cells"); gtk_container_set_border_width (GTK_CONTAINER (window), 5); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/entry_buffer.c b/demos/gtk-demo/entry_buffer.c index 67a4b2f27a..7774467863 100644 --- a/demos/gtk-demo/entry_buffer.c +++ b/demos/gtk-demo/entry_buffer.c @@ -1,7 +1,8 @@ /* Entry/Entry Buffer * * GtkEntryBuffer provides the text content in a GtkEntry. - * + * Applications can provide their own buffer implementation, + * e.g. to provide secure handling for passwords in memory. */ #include <glib/gi18n.h> @@ -20,7 +21,7 @@ do_entry_buffer (GtkWidget *do_widget) if (!window) { - window = gtk_dialog_new_with_buttons ("GtkEntryBuffer", + window = gtk_dialog_new_with_buttons ("Entry Buffer", GTK_WINDOW (do_widget), 0, _("_Close"), diff --git a/demos/gtk-demo/entry_completion.c b/demos/gtk-demo/entry_completion.c index fb71c672cf..301f5d7ea0 100644 --- a/demos/gtk-demo/entry_completion.c +++ b/demos/gtk-demo/entry_completion.c @@ -47,7 +47,7 @@ do_entry_completion (GtkWidget *do_widget) if (!window) { - window = gtk_dialog_new_with_buttons ("GtkEntryCompletion", + window = gtk_dialog_new_with_buttons ("Entry Completion", GTK_WINDOW (do_widget), 0, _("_Close"), diff --git a/demos/gtk-demo/event_axes.c b/demos/gtk-demo/event_axes.c index 71db5705ae..7c77d18372 100644 --- a/demos/gtk-demo/event_axes.c +++ b/demos/gtk-demo/event_axes.c @@ -384,6 +384,7 @@ do_event_axes (GtkWidget *toplevel) if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Event Axes"); gtk_window_set_default_size (GTK_WINDOW (window), 400, 400); g_signal_connect (window, "destroy", diff --git a/demos/gtk-demo/expander.c b/demos/gtk-demo/expander.c index 6228bfd6f7..bc40b542af 100644 --- a/demos/gtk-demo/expander.c +++ b/demos/gtk-demo/expander.c @@ -10,45 +10,85 @@ static GtkWidget *window = NULL; +static void +response_cb (GtkDialog *dialog, gint response_id) +{ + gtk_widget_destroy (window); + window = NULL; +} + +static void +expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog) +{ + gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander)); +} + +static void +do_not_expand (GtkWidget *child, gpointer data) +{ + gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child, + "expand", FALSE, "fill", FALSE, NULL); +} GtkWidget * do_expander (GtkWidget *do_widget) { - GtkWidget *content_area; - GtkWidget *vbox; - GtkWidget *label; + GtkWidget *toplevel; + GtkWidget *area; + GtkWidget *box; GtkWidget *expander; + GtkWidget *sw; + GtkWidget *tv; + GtkTextBuffer *buffer; if (!window) - { - window = gtk_dialog_new_with_buttons ("GtkExpander", - GTK_WINDOW (do_widget), - 0, - _("_Close"), - GTK_RESPONSE_NONE, - NULL); - gtk_window_set_resizable (GTK_WINDOW (window), FALSE); - - g_signal_connect (window, "response", - G_CALLBACK (gtk_widget_destroy), NULL); - g_signal_connect (window, "destroy", - G_CALLBACK (gtk_widget_destroyed), &window); - - content_area = gtk_dialog_get_content_area (GTK_DIALOG (window)); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); - gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); - - label = gtk_label_new ("Expander demo. Click on the triangle for details."); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - - /* Create the expander */ - expander = gtk_expander_new ("Details"); - gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0); - - label = gtk_label_new ("Details can be shown or hidden."); - gtk_container_add (GTK_CONTAINER (expander), label); + { + toplevel = gtk_widget_get_toplevel (do_widget); + window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel), + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "<big><b>%s</b></big>", + "Something went wrong"); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window), + "Here are some more details " + "but not the full story."); + + area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window)); + box = gtk_widget_get_parent (area); + gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box, + "expand", TRUE, "fill", TRUE, NULL); + gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL); + + expander = gtk_expander_new ("Details:"); + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + + tv = gtk_text_view_new (); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv)); + gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD); + gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), + "Finally, the full story with all details. " + "And all the inside information, including " + "error codes, etc etc. Pages of information, " + "you might have to scroll down to read it all, " + "or even resize the window - it works !\n" + "A second paragraph will contain even more " + "innuendo, just to make you scroll down or " + "resize the window. Do it already !", -1); + gtk_container_add (GTK_CONTAINER (sw), tv); + gtk_container_add (GTK_CONTAINER (expander), sw); + gtk_box_pack_end (GTK_BOX (area), expander, TRUE, TRUE, 0); + gtk_widget_show_all (expander); + g_signal_connect (expander, "notify::expanded", + G_CALLBACK (expander_cb), window); + + g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c index 7e8cec8138..4d4a53b069 100644 --- a/demos/gtk-demo/font_features.c +++ b/demos/gtk-demo/font_features.c @@ -186,6 +186,9 @@ do_font_features (GtkWidget *do_widget) toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05")); update (); + + g_signal_connect (window, "destroy", + G_CALLBACK (gtk_widget_destroyed), &window); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c index 9a414fc80b..55d1ae0106 100644 --- a/demos/gtk-demo/gestures.c +++ b/demos/gtk-demo/gestures.c @@ -139,7 +139,7 @@ do_gestures (GtkWidget *do_widget) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 400, 400); - gtk_window_set_title (GTK_WINDOW (window), "Gestures demo"); + gtk_window_set_title (GTK_WINDOW (window), "Gestures"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c index 613c2c99a9..c267706281 100644 --- a/demos/gtk-demo/glarea.c +++ b/demos/gtk-demo/glarea.c @@ -373,7 +373,7 @@ create_glarea_window (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "GtkGLArea - Golden Triangle"); + gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area"); gtk_window_set_default_size (GTK_WINDOW (window), 400, 600); gtk_container_set_border_width (GTK_CONTAINER (window), 12); g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL); diff --git a/demos/gtk-demo/iconview.c b/demos/gtk-demo/iconview.c index a377146165..199a34316c 100644 --- a/demos/gtk-demo/iconview.c +++ b/demos/gtk-demo/iconview.c @@ -255,7 +255,7 @@ do_iconview (GtkWidget *do_widget) gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo"); + gtk_window_set_title (GTK_WINDOW (window), "Icon View Basics"); g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL); diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c index 2bee2d4055..7b0b5751c0 100644 --- a/demos/gtk-demo/infobar.c +++ b/demos/gtk-demo/infobar.c @@ -1,4 +1,4 @@ -/* Info bar +/* Info Bars * * Info bar widgets are used to report important messages to the user. */ diff --git a/demos/gtk-demo/list_store.c b/demos/gtk-demo/list_store.c index b20c4b2b1c..6a77071f66 100644 --- a/demos/gtk-demo/list_store.c +++ b/demos/gtk-demo/list_store.c @@ -258,7 +258,7 @@ do_list_store (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo"); + gtk_window_set_title (GTK_WINDOW (window), "List Store"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/menus.c b/demos/gtk-demo/menus.c index 44b352f4c9..9e69afa6ad 100644 --- a/demos/gtk-demo/menus.c +++ b/demos/gtk-demo/menus.c @@ -18,10 +18,6 @@ * A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop * up when the menu item is selected. Typically, all menu items in a menu bar * have submenus. - * - * GtkUIManager provides a higher-level interface for creating menu bars - * and menus; while you can construct menus manually, most people don't - * do that. There's a separate demo for GtkUIManager. */ #include <gtk/gtk.h> @@ -30,7 +26,7 @@ #include <stdio.h> static GtkWidget * -create_menu (gint depth) +create_menu (gint depth) { GtkWidget *menu; GtkRadioMenuItem *last_item; @@ -120,6 +116,7 @@ do_menus (GtkWidget *do_widget) gtk_widget_show (box1); menubar = gtk_menu_bar_new (); + gtk_widget_set_hexpand (menubar, TRUE); gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0); gtk_widget_show (menubar); diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c index 9109e271c2..7c72194cf2 100644 --- a/demos/gtk-demo/offscreen_window.c +++ b/demos/gtk-demo/offscreen_window.c @@ -577,7 +577,7 @@ do_offscreen_window (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Rotated widget"); + gtk_window_set_title (GTK_WINDOW (window), "Rotated Button"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c index 2811b36c74..97c7237b84 100644 --- a/demos/gtk-demo/panes.c +++ b/demos/gtk-demo/panes.c @@ -1,14 +1,14 @@ /* Paned Widgets * - * The GtkHPaned and GtkVPaned Widgets divide their content - * area into two panes with a divider in between that the - * user can adjust. A separate child is placed into each - * pane. + * The GtkPaned Widget divides its content area into two panes + * with a divider in between that the user can adjust. A separate + * child is placed into each pane. GtkPaned widgets can be split + * horizontally or vertially. * * There are a number of options that can be set for each pane. - * This test contains both a horizontal (HPaned) and a vertical - * (VPaned) widget, and allows you to adjust the options for - * each side of each widget. + * This test contains both a horizontal and a vertical GtkPaned + * widget, and allows you to adjust the options for each side of + * each widget. */ #include <gtk/gtk.h> @@ -141,7 +141,7 @@ do_panes (GtkWidget *do_widget) g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); - gtk_window_set_title (GTK_WINDOW (window), "Panes"); + gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c index 4d6b7a4d16..988eaace23 100644 --- a/demos/gtk-demo/search_entry2.c +++ b/demos/gtk-demo/search_entry2.c @@ -84,7 +84,7 @@ do_search_entry2 (GtkWidget *do_widget) if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "Search Entry #2"); + gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_resizable (GTK_WINDOW (window), TRUE); gtk_widget_set_size_request (window, 200, -1); diff --git a/demos/gtk-demo/sidebar.c b/demos/gtk-demo/sidebar.c index 1422d10951..61f4dcf386 100644 --- a/demos/gtk-demo/sidebar.c +++ b/demos/gtk-demo/sidebar.c @@ -43,7 +43,7 @@ do_sidebar (GtkWidget *do_widget) header = gtk_header_bar_new (); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE); gtk_window_set_titlebar (GTK_WINDOW(window), header); - gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar demo"); + gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c index e38340195a..d99cc8a0b7 100644 --- a/demos/gtk-demo/sizegroup.c +++ b/demos/gtk-demo/sizegroup.c @@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget) if (!window) { - window = gtk_dialog_new_with_buttons ("GtkSizeGroup", + window = gtk_dialog_new_with_buttons ("Size Groups", GTK_WINDOW (do_widget), 0, _("_Close"), diff --git a/demos/gtk-demo/spinner.c b/demos/gtk-demo/spinner.c index 3e04ad843c..c0690a6e75 100644 --- a/demos/gtk-demo/spinner.c +++ b/demos/gtk-demo/spinner.c @@ -36,7 +36,7 @@ do_spinner (GtkWidget *do_widget) if (!window) { - window = gtk_dialog_new_with_buttons ("GtkSpinner", + window = gtk_dialog_new_with_buttons ("Spinner", GTK_WINDOW (do_widget), 0, _("_Close"), diff --git a/demos/gtk-demo/stack.c b/demos/gtk-demo/stack.c index badcd99ba0..d536187943 100644 --- a/demos/gtk-demo/stack.c +++ b/demos/gtk-demo/stack.c @@ -14,17 +14,10 @@ GtkWidget * do_stack (GtkWidget *do_widget) { static GtkWidget *window = NULL; - GError *err = NULL; if (!window) { - builder = gtk_builder_new (); - gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err); - if (err) - { - g_error ("ERROR: %s\n", err->message); - return NULL; - } + builder = gtk_builder_new_from_resource ("/stack/stack.ui"); gtk_builder_connect_signals (builder, NULL); window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); gtk_window_set_screen (GTK_WINDOW (window), diff --git a/demos/gtk-demo/stack.ui b/demos/gtk-demo/stack.ui index 334c145b22..292bed8ac1 100644 --- a/demos/gtk-demo/stack.ui +++ b/demos/gtk-demo/stack.ui @@ -3,7 +3,7 @@ <!-- interface-requires gtk+ 3.6 --> <object class="GtkWindow" id="window1"> <property name="can_focus">False</property> - <property name="title" translatable="yes">GtkStack</property> + <property name="title" translatable="yes">Stack</property> <child> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> diff --git a/demos/gtk-demo/textscroll.c b/demos/gtk-demo/textscroll.c index 90ae13b5ee..0008838496 100644 --- a/demos/gtk-demo/textscroll.c +++ b/demos/gtk-demo/textscroll.c @@ -181,6 +181,7 @@ do_textscroll (GtkWidget *do_widget) GtkWidget *hbox; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c index 9422759ef7..f1fc6bb33e 100644 --- a/demos/gtk-demo/textview.c +++ b/demos/gtk-demo/textview.c @@ -480,7 +480,7 @@ do_textview (GtkWidget *do_widget) g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); - gtk_window_set_title (GTK_WINDOW (window), "TextView"); + gtk_window_set_title (GTK_WINDOW (window), "Multiple Views"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); diff --git a/demos/gtk-demo/transparent.c b/demos/gtk-demo/transparent.c index c6e59c8fca..ea685a1a5f 100644 --- a/demos/gtk-demo/transparent.c +++ b/demos/gtk-demo/transparent.c @@ -11,9 +11,9 @@ static void draw_shadow_box (cairo_t *cr, - GdkRectangle rect, - double radius, - double transparency) + GdkRectangle rect, + double radius, + double transparency) { cairo_pattern_t *pattern; double x0, x1, x2, x3; @@ -23,140 +23,140 @@ draw_shadow_box (cairo_t *cr, x1 = rect.x + radius; x2 = rect.x + rect.width - radius; x3 = rect.x + rect.width; - + y0 = rect.y; y1 = rect.y + radius; y2 = rect.y + rect.height - radius; y3 = rect.y + rect.height; - + /* Fill non-border part */ cairo_set_source_rgba (cr, 0, 0, 0, transparency); cairo_rectangle (cr, - x1, y1, x2 - x1, y2 - y1); + x1, y1, x2 - x1, y2 - y1); cairo_fill (cr); /* Upper border */ pattern = cairo_pattern_create_linear (0, y0, 0, y1); - + cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x1, y0, - x2 - x1, y1 - y0); + x1, y0, + x2 - x1, y1 - y0); cairo_fill (cr); /* Bottom border */ pattern = cairo_pattern_create_linear (0, y2, 0, y3); - + cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x1, y2, - x2 - x1, y3 - y2); + x1, y2, + x2 - x1, y3 - y2); cairo_fill (cr); - + /* Left border */ pattern = cairo_pattern_create_linear (x0, 0, x1, 0); - + cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x0, y1, - x1 - x0, y2 - y1); + x0, y1, + x1 - x0, y2 - y1); cairo_fill (cr); /* Right border */ pattern = cairo_pattern_create_linear (x2, 0, x3, 0); - + cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x2, y1, - x3 - x2, y2 - y1); + x2, y1, + x3 - x2, y2 - y1); cairo_fill (cr); /* NW corner */ - + pattern = cairo_pattern_create_radial (x1, y1, 0, - x1, y1, radius); + x1, y1, radius); cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x0, y0, - x1 - x0, y1 - y0); + x0, y0, + x1 - x0, y1 - y0); cairo_fill (cr); /* NE corner */ - + pattern = cairo_pattern_create_radial (x2, y1, 0, - x2, y1, radius); + x2, y1, radius); cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x2, y0, - x3 - x2, y1 - y0); + x2, y0, + x3 - x2, y1 - y0); cairo_fill (cr); /* SW corner */ - + pattern = cairo_pattern_create_radial (x1, y2, 0, - x1, y2, radius); + x1, y2, radius); cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x0, y2, - x1 - x0, y3 - y2); + x0, y2, + x1 - x0, y3 - y2); cairo_fill (cr); /* SE corner */ - + pattern = cairo_pattern_create_radial (x2, y2, 0, - x2, y2, radius); + x2, y2, radius); cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency); cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0); - + cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); - + cairo_rectangle (cr, - x2, y2, - x3 - x2, y3 - y2); + x2, y2, + x3 - x2, y3 - y2); cairo_fill (cr); } @@ -174,8 +174,8 @@ draw_callback (GtkWidget *widget, rect.height -= SHADOW_OFFSET_Y; draw_shadow_box (cr, - rect, SHADOW_RADIUS, 0.4); - + rect, SHADOW_RADIUS, 0.4); + return FALSE; } @@ -202,7 +202,7 @@ do_transparent (GtkWidget *do_widget) g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); - gtk_window_set_title (GTK_WINDOW (window), "Transparent"); + gtk_window_set_title (GTK_WINDOW (window), "Transparency"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); view = gtk_text_view_new (); @@ -230,7 +230,6 @@ do_transparent (GtkWidget *do_widget) gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry); gtk_widget_set_halign (entry, GTK_ALIGN_CENTER); gtk_widget_set_valign (entry, GTK_ALIGN_START); - gtk_widget_show_all (overlay); } diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index c51b9464cf..3706e4dfb5 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -398,7 +398,7 @@ do_tree_store (GtkWidget *do_widget) window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet"); + gtk_window_set_title (GTK_WINDOW (window), "Tree Store"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); |