diff options
-rw-r--r-- | gtk/gtkiconview.c | 9 | ||||
-rw-r--r-- | gtk/gtklabel.c | 2 | ||||
-rw-r--r-- | gtk/gtkmain.c | 12 | ||||
-rw-r--r-- | gtk/gtktogglebutton.c | 23 |
4 files changed, 32 insertions, 14 deletions
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index a01879afa8..f0082f28df 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -4993,8 +4993,15 @@ gtk_icon_view_unselect_path (GtkIconView *icon_view, * want to convert the returned list into a list of `GtkTreeRowReferences`. * To do this, you can use gtk_tree_row_reference_new(). * - * To free the return value, use: + * To free the return value, use `g_lsit_free_full`: * |[<!-- language="C" --> + * GtkWidget *icon_view = gtk_icon_view_new (); + * // Use icon_view + * + * GList *list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (icon_view)); + * + * // use list + * * g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free); * ]| * diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 10ee98f5a8..5def4168b6 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1186,7 +1186,7 @@ my_pango_layout_get_width_for_height (PangoLayout *layout, pango_layout_get_size (layout, &text_width, &text_height); text_width = PANGO_PIXELS_CEIL (text_width); if (text_width > mid) - min = mid = text_width; + min = text_width; else if (text_height > for_height) min = mid + 1; else diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 352e32fdcd..c96bfb3c81 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -753,9 +753,15 @@ gtk_is_initialized (void) * you can use it to update the default text direction as follows: * * |[<!-- language="C" --> - * setlocale (LC_ALL, new_locale); - * direction = gtk_get_locale_direction (); - * gtk_widget_set_default_direction (direction); + * #include <locale.h> + * + * static void + * update_locale (const char *new_locale) + * { + * setlocale (LC_ALL, new_locale); + * GtkTextDirection direction = gtk_get_locale_direction (); + * gtk_widget_set_default_direction (direction); + * } * ]| * * Returns: the `GtkTextDirection` of the current locale diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 1774508bc5..ce09a45edb 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -19,7 +19,7 @@ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" @@ -55,7 +55,7 @@ * To simply switch the state of a toggle button, use * [method@Gtk.ToggleButton.toggled]. * - * # Grouping + * ## Grouping * * Toggle buttons can be grouped together, to form mutually exclusive * groups - only one of the buttons can be toggled at a time, and toggling @@ -63,20 +63,25 @@ * * To add a `GtkToggleButton` to a group, use [method@Gtk.ToggleButton.set_group]. * - * # CSS nodes + * ## CSS nodes * * `GtkToggleButton` has a single CSS node with name button. To differentiate - * it from a plain `GtkButton`, it gets the .toggle style class. + * it from a plain `GtkButton`, it gets the `.toggle` style class. * * ## Creating two `GtkToggleButton` widgets. * * ```c - * static void output_state (GtkToggleButton *source, gpointer user_data) + * static void + * output_state (GtkToggleButton *source, + * gpointer user_data) * { - * printf ("Active: %d\n", gtk_toggle_button_get_active (source)); + * g_print ("Toggle button "%s" is active: %s", + * gtk_button_get_label (GTK_BUTTON (source)), + * gtk_toggle_button_get_active (source) ? "Yes" : "No"); * } * - * void make_toggles (void) + * static void + * make_toggles (void) * { * GtkWidget *window, *toggle1, *toggle2; * GtkWidget *box; @@ -85,7 +90,7 @@ * window = gtk_window_new (); * box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); * - * text = "Hi, I’m a toggle button."; + * text = "Hi, I’m toggle button one"; * toggle1 = gtk_toggle_button_new_with_label (text); * * g_signal_connect (toggle1, "toggled", @@ -93,7 +98,7 @@ * NULL); * gtk_box_append (GTK_BOX (box), toggle1); * - * text = "Hi, I’m a toggle button."; + * text = "Hi, I’m toggle button two"; * toggle2 = gtk_toggle_button_new_with_label (text); * g_signal_connect (toggle2, "toggled", * G_CALLBACK (output_state), |