diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | docs/reference/gtk/Makefile.am | 2 | ||||
-rw-r--r-- | docs/reference/gtk/gtk-docs.sgml | 1 | ||||
-rw-r--r-- | docs/reference/gtk/gtk3-sections.txt | 33 | ||||
-rw-r--r-- | docs/reference/gtk/migrating-GtkApplication.xml | 127 | ||||
-rw-r--r-- | gtk/gtk.symbols | 4 | ||||
-rw-r--r-- | gtk/gtkapplication.c | 41 | ||||
-rw-r--r-- | gtk/gtkapplication.h | 3 | ||||
-rw-r--r-- | gtk/gtkcolorbutton.c | 10 | ||||
-rw-r--r-- | gtk/gtkcombobox.c | 90 | ||||
-rw-r--r-- | gtk/gtkcombobox.h | 3 | ||||
-rw-r--r-- | gtk/gtkcomboboxtext.c | 34 | ||||
-rw-r--r-- | gtk/gtkcomboboxtext.h | 4 | ||||
-rw-r--r-- | gtk/gtkentry.c | 9 | ||||
-rw-r--r-- | gtk/gtkgrid.h | 2 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 54 | ||||
-rw-r--r-- | gtk/gtktable.c | 2 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 20 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 13 |
19 files changed, 285 insertions, 168 deletions
@@ -13,7 +13,6 @@ Overview of Changes from GTK+ 2.91.1 to 2.91.2 - Popups can be wider than the combo box itself - The deprecated GtkComboBoxEntry subclass has been removed - The deprecated combo box text convenience API has been removed - - Numeric IDs can be associated with model values * GtkRecentManager changes: - Store xbel file in XDG_USER_DATA diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am index 162eb2e50e..9b065dd5ac 100644 --- a/docs/reference/gtk/Makefile.am +++ b/docs/reference/gtk/Makefile.am @@ -121,6 +121,7 @@ content_files = \ glossary.xml \ migrating-2to3.xml \ migrating-checklist.sgml \ + migrating-GtkApplication.xml \ objects_grouped.sgml \ osx.sgml \ question_index.sgml \ @@ -142,6 +143,7 @@ expand_content_files = \ glossary.xml \ migrating-2to3.xml \ migrating-checklist.sgml \ + migrating-GtkApplication.xml \ question_index.sgml \ text_widget.sgml \ tree_widget.sgml diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml index 519879eed2..38e057fe8a 100644 --- a/docs/reference/gtk/gtk-docs.sgml +++ b/docs/reference/gtk/gtk-docs.sgml @@ -330,6 +330,7 @@ <xi:include href="xml/migrating-checklist.sgml" /> <xi:include href="xml/migrating-2to3.xml" /> + <xi:include href="xml/migrating-GtkApplication.xml" /> </part> <part> diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index da659d10c6..aeef317eb2 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -89,6 +89,7 @@ GTK_IS_ACCEL_GROUP_CLASS GTK_ACCEL_GROUP_GET_CLASS <SUBSECTION Private> +GTK_ACCEL_GROUP_GET_PRIVATE GtkAccelGroupPrivate GtkAccelGroupEntry gtk_accel_group_get_type @@ -163,6 +164,7 @@ GTK_ACCESSIBLE_GET_CLASS GTK_IS_ACCESSIBLE GTK_IS_ACCESSIBLE_CLASS <SUBSECTION Private> +GtkAccessiblePrivate gtk_accessible_get_type </SECTION> @@ -397,6 +399,7 @@ GTK_ARROW_CLASS GTK_IS_ARROW_CLASS GTK_ARROW_GET_CLASS <SUBSECTION Private> +GtkArrowPrivate gtk_arrow_get_type </SECTION> @@ -668,6 +671,7 @@ gtk_check_menu_item_get_type GtkColorButton gtk_color_button_new gtk_color_button_new_with_color +gtk_color_button_new_with_rgba gtk_color_button_set_color gtk_color_button_get_color gtk_color_button_set_alpha @@ -804,8 +808,8 @@ gtk_combo_box_get_button_sensitivity gtk_combo_box_get_has_entry gtk_combo_box_set_entry_text_column gtk_combo_box_get_entry_text_column -gtk_combo_box_set_id_column -gtk_combo_box_get_id_column +gtk_combo_box_set_popup_fixed_width +gtk_combo_box_get_popup_fixed_width <SUBSECTION Standard> GTK_TYPE_COMBO_BOX GTK_COMBO_BOX @@ -825,9 +829,8 @@ GtkComboBoxText gtk_combo_box_text_new gtk_combo_box_text_new_with_entry gtk_combo_box_text_append_text -gtk_combo_box_text_prepend_text gtk_combo_box_text_insert_text -gtk_combo_box_text_insert_text_with_id +gtk_combo_box_text_prepend_text gtk_combo_box_text_remove gtk_combo_box_text_remove_all gtk_combo_box_text_get_active_text @@ -845,6 +848,7 @@ GtkComboBoxTextPrivate gtk_combo_box_text_get_type </SECTION> +<SECTION> <FILE>gtkcontainer</FILE> <TITLE>GtkContainer</TITLE> GtkContainer @@ -971,6 +975,7 @@ GTK_TYPE_EDITABLE GTK_EDITABLE_CLASS GTK_IS_EDITABLE_CLASS GTK_EDITABLE_GET_CLASS +GTK_EDITABLE_GET_IFACE <SUBSECTION Private> gtk_editable_get_type </SECTION> @@ -986,6 +991,7 @@ gtk_entry_set_buffer gtk_entry_set_text gtk_entry_get_text gtk_entry_get_text_length +gtk_entry_get_text_area gtk_entry_set_visibility gtk_entry_set_invisible_char gtk_entry_unset_invisible_char @@ -1041,6 +1047,7 @@ gtk_entry_set_icon_tooltip_markup gtk_entry_get_icon_tooltip_markup gtk_entry_set_icon_drag_source gtk_entry_get_current_icon_drag_source +gtk_entry_get_icon_area <SUBSECTION Standard> GTK_ENTRY @@ -3403,9 +3410,7 @@ gtk_text_view_new gtk_text_view_new_with_buffer gtk_text_view_set_buffer gtk_text_view_get_buffer -gtk_text_view_set_hadjustment gtk_text_view_get_hadjustment -gtk_text_view_set_vadjustment gtk_text_view_get_vadjustment gtk_text_view_scroll_to_mark gtk_text_view_scroll_to_iter @@ -3832,9 +3837,8 @@ gtk_tool_palette_get_drop_item GtkToolPaletteDragTargets gtk_tool_palette_set_drag_source gtk_tool_palette_get_hadjustment -gtk_tool_palette_set_hadjustment gtk_tool_palette_get_vadjustment -gtk_tool_palette_set_vadjustment + <SUBSECTION Standard> GtkToolPaletteClass GTK_TOOL_PALETTE @@ -4332,6 +4336,7 @@ gtk_cell_view_set_displayed_row gtk_cell_view_get_displayed_row gtk_cell_view_get_size_of_row gtk_cell_view_set_background_color +gtk_cell_view_set_background_rgba <SUBSECTION Standard> GtkCellViewClass GTK_TYPE_CELL_VIEW @@ -5022,6 +5027,7 @@ gtk_window_activate_focus gtk_window_activate_default gtk_window_set_modal gtk_window_set_default_size +gtk_window_set_default_geometry gtk_window_set_geometry_hints gtk_window_set_gravity gtk_window_get_gravity @@ -5100,6 +5106,7 @@ gtk_window_move gtk_window_parse_geometry gtk_window_reshow_with_initial_size gtk_window_resize +gtk_window_resize_to_geometry gtk_window_set_default_icon_list gtk_window_set_default_icon gtk_window_set_default_icon_from_file @@ -5115,8 +5122,10 @@ gtk_window_get_mnemonics_visible gtk_window_set_mnemonics_visible gtk_window_set_has_resize_grip gtk_window_get_has_resize_grip -gtk_window_get_resize_grip_is_visible +gtk_window_resize_grip_is_visible gtk_window_get_resize_grip_area +gtk_window_get_application +gtk_window_set_application <SUBSECTION Standard> GTK_WINDOW @@ -5410,6 +5419,7 @@ GTK_TYPE_TARGET_LIST <SUBSECTION Private> gtk_selection_data_get_type gtk_target_list_get_type +gtk_target_entry_get_type </SECTION> <SECTION> @@ -6339,14 +6349,9 @@ gtk_orientable_get_type GtkApplication gtk_application_new -gtk_application_run -gtk_application_quit -gtk_application_set_action_group -gtk_application_get_window gtk_application_add_window gtk_application_remove_window gtk_application_get_windows -gtk_application_create_window <SUBSECTION Standard> GtkApplicationClass diff --git a/docs/reference/gtk/migrating-GtkApplication.xml b/docs/reference/gtk/migrating-GtkApplication.xml new file mode 100644 index 0000000000..828b27664e --- /dev/null +++ b/docs/reference/gtk/migrating-GtkApplication.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" + "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ +]> +<chapter id="gtk-migrating-GtkApplication"> + + <title>Migrating from libunique to GApplication or GtkApplication</title> + + <para> + libunique offers 'unique application' support as well as ways to + communicate with a running application instance. This is implemented + in various ways, either using D-Bus, or socket-based communication. + </para> + + <para> + Starting with GLib 2.26, D-Bus support has been integrated into GIO + in the form of GDBus, and #GApplication has been added to provide + the same level of application support as libunique. + </para> + + <example><title>A unique application</title> + <para>Here is a simple application using libunique: + <programlisting> +int +main (int argc, char *argv[]) +{ + UniqueApp *app; + GtkWidget *window; + + gtk_init (&argc, &argv); + + app = unique_app_new ("org.gtk.TestApplication", NULL); + + if (unique_app_is_running (app)) + { + UniqueResponse response; + + response = unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); + g_object_unref (app); + + return response == UNIQUE_RESPONSE_OK ? 0 : 1; + } + + window = create_my_window (); + + unique_app_watch_window (app, GTK_WINDOW (window)); + + gtk_widget_show (window); + + gtk_main (); + + g_object_unref (app); + + return 0; +} +</programlisting> +The same application using GtkApplication: +<programlisting> +static void +activate (GtkApplication *app) +{ + GtkWidget *window; + + window = create_my_window (); + gtk_window_set_application (GTK_WINDOW (window), app); + gtk_widget_show (window); +} + +int +main (int argc, char *argv[]) +{ + GtkApplication *app; + gint status; + + app = gtk_application_new ("org.gtk.TestApplication", 0); + g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); + + status = g_application_run (app); + + g_object_unref (app); + + return status; +} +</programlisting> +</para> +</example> + <section><title>Uniqueness</title> + <para> + Instead of creating a #UniqueApp with unique_app_new(), create + a #GApplication with g_application_new() or a #GtkApplication + with gtk_application_new(). The @name that was used with + unique_app_new() is very likely usable as the @application_id for + g_application_new() without any changes, and GtkApplication passes + the <envar>DESKTOP_STARTUP_ID</envar> environment variable + automatically. + </para> + <para> + While libunique expects you to check for an already running instance + yourself and activate it manually, GApplication handles all this on + its own in g_application_run(). If you still need to find out if there + is a running instance of your application, use + g_application_get_is_remote() instead of unique_app_is_running(). + </para> + </section> + + <section><title>Commands and Messages</title> + <para> + libunique lets you send messages with commands to a running + instance using unique_app_send_message(). GApplication does not + have a direct equivalent for this feature at this time, but + some of the predefined libunique commands have equivalents in + GApplication. Instead of sending the %UNIQUE_ACTIVATE command, + call g_application_activate(), instead of sending the + %UNIQUE_OPEN command, call g_application_open(). The + %UNIQUE_NEW and %UNIQUE_CLOSE and user-defined commands don't + have direct replacement at this time. + </para> + + <para> + One the other hand, GApplication supports passing entire + commandlines to the running instance, which reduces the need + for user-defined commands. And GDBus makes it very easy to + implement D-Bus interfaces for communication between + application instances, see e.g. g_dbus_connection_register_object(). + </para> + </section> +</chapter> diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 0ee0e314c5..c8df972e39 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -754,6 +754,7 @@ gtk_color_button_get_type G_GNUC_CONST gtk_color_button_get_use_alpha gtk_color_button_new gtk_color_button_new_with_color +gtk_color_button_new_with_rgba gtk_color_button_set_alpha gtk_color_button_set_color gtk_color_button_set_title @@ -801,7 +802,6 @@ gtk_combo_box_get_column_span_column gtk_combo_box_get_entry_text_column gtk_combo_box_get_focus_on_click gtk_combo_box_get_has_entry -gtk_combo_box_get_id_column gtk_combo_box_get_model gtk_combo_box_get_popup_accessible gtk_combo_box_get_popup_fixed_width @@ -823,7 +823,6 @@ gtk_combo_box_set_add_tearoffs gtk_combo_box_set_column_span_column gtk_combo_box_set_entry_text_column gtk_combo_box_set_focus_on_click -gtk_combo_box_set_id_column gtk_combo_box_set_model gtk_combo_box_set_popup_fixed_width gtk_combo_box_set_row_separator_func @@ -840,7 +839,6 @@ gtk_combo_box_text_append_text gtk_combo_box_text_get_active_text gtk_combo_box_text_get_type G_GNUC_CONST gtk_combo_box_text_insert_text -gtk_combo_box_text_insert_text_with_id gtk_combo_box_text_new gtk_combo_box_text_new_with_entry gtk_combo_box_text_prepend_text diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 11af1baed3..70c9754177 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -44,11 +44,11 @@ * of a GTK+ application in a convenient fashion, without enforcing * a one-size-fits-all application model. * - * Currently, GtkApplication handles application uniqueness, provides - * some basic scriptability by exporting 'actions', implements some - * standard actions itself (such as 'Quit') and provides a main window - * whose life-cycle is automatically tied to the life-cycle of your - * application. + * Currently, GtkApplication handles GTK+ initialization, application + * uniqueness, provides some basic scriptability by exporting 'actions', + * implements some standard actions itself (such as 'Quit') and manages + * a list of toplevel windows whose life-cycle is automatically tied to + * the life-cycle of your application. * * <example id="gtkapplication"><title>A simple application</title> * <programlisting> @@ -151,6 +151,20 @@ gtk_application_class_init (GtkApplicationClass *class) g_type_class_add_private (class, sizeof (GtkApplicationPrivate)); } +/** + * gtk_application_new: + * @application_id: the application id + * @flags: the application flags + * + * Creates a new #GtkApplication instance. + * + * This function calls g_type_init() for you. gtk_init() is called + * as soon as the application gets registered as the primary instance. + * + * The application id must be valid. See g_application_id_is_valid(). + * + * Returns: a new #GtkApplication instance + */ GtkApplication * gtk_application_new (const gchar *application_id, GApplicationFlags flags) @@ -181,12 +195,15 @@ void gtk_application_add_window (GtkApplication *application, GtkWindow *window) { + GtkApplicationPrivate *priv; + g_return_if_fail (GTK_IS_APPLICATION (application)); - if (!g_list_find (application->priv->windows, window)) + priv = application->priv; + + if (!g_list_find (priv->windows, window)) { - application->priv->windows = g_list_prepend (application->priv->windows, - window); + priv->windows = g_list_prepend (priv->windows, window); gtk_window_set_application (window, application); g_application_hold (G_APPLICATION (application)); } @@ -212,12 +229,14 @@ void gtk_application_remove_window (GtkApplication *application, GtkWindow *window) { + GtkApplicationPrivate *priv; + g_return_if_fail (GTK_IS_APPLICATION (application)); - if (g_list_find (application->priv->windows, window)) + priv = application->priv; + if (g_list_find (priv->windows, window)) { - application->priv->windows = g_list_remove (application->priv->windows, - window); + priv->windows = g_list_remove (priv->windows, window); g_application_release (G_APPLICATION (application)); gtk_window_set_application (window, NULL); } diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h index c9c8571a46..8fafd4ef5b 100644 --- a/gtk/gtkapplication.h +++ b/gtk/gtkapplication.h @@ -55,9 +55,6 @@ struct _GtkApplicationClass { GApplicationClass parent_class; - /*< vfuncs >*/ - GtkWindow *(* create_window) (GtkApplication *application); - /*< private >*/ gpointer padding[12]; }; diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 9548280010..2e2214f85b 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -537,6 +537,16 @@ gtk_color_button_new_with_color (const GdkColor *color) return g_object_new (GTK_TYPE_COLOR_BUTTON, "color", color, NULL); } +/** + * gtk_color_button_new_with_rgba: + * @rgba: A #GdkRGBA to set the current color with. + * + * Creates a new color button. + * + * Returns: a new color button + * + * Since: 3.0 + */ GtkWidget * gtk_color_button_new_with_rgba (const GdkRGBA *rgba) { diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 64023569e3..c17326e3df 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -143,8 +143,6 @@ struct _GtkComboBoxPrivate gint text_column; GtkCellRenderer *text_renderer; - gint id_column; - GSList *cells; guint popup_in_progress : 1; @@ -247,8 +245,7 @@ enum { PROP_EDITING_CANCELED, PROP_HAS_ENTRY, PROP_ENTRY_TEXT_COLUMN, - PROP_POPUP_FIXED_WIDTH, - PROP_ID_COLUMN + PROP_POPUP_FIXED_WIDTH }; static guint combo_box_signals[LAST_SIGNAL] = {0,}; @@ -952,23 +949,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) GTK_PARAM_READWRITE)); /** - * GtkComboBox:id-column: - * - * The column in the combo box's model that provides numeric - * IDs for the values in the model, if != -1. - * - * Since: 3.0 - */ - g_object_class_install_property (object_class, - PROP_ID_COLUMN, - g_param_spec_int ("id-column", - P_("ID Column"), - P_("The column in the combo box's model that provides " - "numeric IDs for the values in the model"), - -1, G_MAXINT, -1, - GTK_PARAM_READWRITE)); - - /** * GtkComboBox:popup-fixed-width: * * Whether the popup's width should be a fixed width matching the @@ -1097,7 +1077,6 @@ gtk_combo_box_init (GtkComboBox *combo_box) priv->text_column = -1; priv->text_renderer = NULL; - priv->id_column = -1; gtk_combo_box_check_appearance (combo_box); } @@ -1189,10 +1168,6 @@ gtk_combo_box_set_property (GObject *object, gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value)); break; - case PROP_ID_COLUMN: - gtk_combo_box_set_id_column (combo_box, g_value_get_int (value)); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1270,10 +1245,6 @@ gtk_combo_box_get_property (GObject *object, g_value_set_int (value, priv->text_column); break; - case PROP_ID_COLUMN: - g_value_set_int (value, priv->id_column); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -5900,14 +5871,14 @@ gtk_combo_box_set_title (GtkComboBox *combo_box, * @combo_box: a #GtkComboBox * @fixed: whether to use a fixed popup width * - * Specifies whether the popup's width should be a fixed width matching - * the allocated width of the combo box. + * Specifies whether the popup's width should be a fixed width + * matching the allocated width of the combo box. * * Since: 3.0 **/ void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, - gboolean fixed) + gboolean fixed) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); @@ -5923,9 +5894,11 @@ gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, * gtk_combo_box_get_popup_fixed_width: * @combo_box: a #GtkComboBox * - * Gets whether the popup uses a fixed width matching + * Gets whether the popup uses a fixed width matching * the allocated width of the combo box. * + * Returns: %TRUE if the popup uses a fixed width + * * Since: 3.0 **/ gboolean @@ -6573,7 +6546,7 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, xpad = 2 * (border_width + cell_style->xthickness); ypad = 2 * (border_width + cell_style->ythickness); - } + } size -= but_width; size -= 2 * focus_width; @@ -6602,50 +6575,3 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, if (natural_size) *natural_size = nat_height; } - -/** - * gtk_combo_box_set_id_column: - * @combo_box: A #GtkComboBox - * @id_column: A column in @model to get numeric IDs for values from - * - * Sets the model column which @combo_box should use to get numeric IDs - * for values from. The column @id_column in the model of @combo_box - * must be of type %G_TYPE_INT. - * - * Since: 3.0 - */ -void -gtk_combo_box_set_id_column (GtkComboBox *combo_box, - gint id_column) -{ - GtkComboBoxPrivate *priv = combo_box->priv; - GtkTreeModel *model; - - g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); - - model = gtk_combo_box_get_model (combo_box); - - g_return_if_fail (id_column >= 0); - g_return_if_fail (model == NULL || id_column < gtk_tree_model_get_n_columns (model)); - - priv->id_column = id_column; -} - -/** - * gtk_combo_box_get_id_column: - * @combo_box: A #GtkComboBox - * - * Returns the column which @combo_box is using to get numeric IDs - * for values from. - * - * Return value: A column in the data source model of @combo_box. - * - * Since: 3.0 - */ -gint -gtk_combo_box_get_id_column (GtkComboBox *combo_box) -{ - g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0); - - return combo_box->priv->id_column; -} diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h index ac256a7746..c5b6a3c1e0 100644 --- a/gtk/gtkcombobox.h +++ b/gtk/gtkcombobox.h @@ -133,9 +133,6 @@ void gtk_combo_box_popup_for_device (GtkComboBox *combo_box, void gtk_combo_box_popdown (GtkComboBox *combo_box); AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box); -gint gtk_combo_box_get_id_column (GtkComboBox *combo_box); -void gtk_combo_box_set_id_column (GtkComboBox *combo_box, - gint id_column); G_END_DECLS diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c index d8df72fdf1..db3a4e86aa 100644 --- a/gtk/gtkcomboboxtext.c +++ b/gtk/gtkcomboboxtext.c @@ -72,7 +72,7 @@ gtk_combo_box_text_init (GtkComboBoxText *combo_box) { GtkListStore *store; - store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); + store = gtk_list_store_new (1, G_TYPE_STRING); gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store)); g_object_unref (store); } @@ -102,7 +102,6 @@ gtk_combo_box_text_new (void) { return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, "entry-text-column", 0, - "id-column", 1, NULL); } @@ -122,7 +121,6 @@ gtk_combo_box_text_new_with_entry (void) return g_object_new (GTK_TYPE_COMBO_BOX_TEXT, "has-entry", TRUE, "entry-text-column", 0, - "id-column", 1, NULL); } @@ -173,27 +171,6 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, gint position, const gchar *text) { - gtk_combo_box_text_insert_text_with_id (combo_box, position, text, 0); -} - -/** - * gtk_combo_box_text_insert_text_with_id: - * @combo_box: A #GtkComboBoxText - * @position: An index to insert @text - * @text: A string - * @id: a numeric ID for this value - * - * Inserts @text at @position in the list of strings stored in @combo_box, - * and sets its numeric ID to @id. See #GtkComboBox::id-column. - * - * Since: 3.0 - */ -void -gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, - gint position, - const gchar *text, - gint id) -{ GtkListStore *store; GtkTreeIter iter; gint text_column; @@ -209,18 +186,11 @@ gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box)); column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column); g_return_if_fail (column_type == G_TYPE_STRING); - id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box)); - if (id_column != -1) - { - column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column); - g_return_if_fail (column_type == G_TYPE_INT); - } gtk_list_store_insert (store, &iter, position); - gtk_list_store_set (store, &iter, text_column, text, id_column, id, -1); + gtk_list_store_set (store, &iter, text_column, text, -1); } - /** * gtk_combo_box_text_remove: * @combo_box: A #GtkComboBox diff --git a/gtk/gtkcomboboxtext.h b/gtk/gtkcomboboxtext.h index 7322e45134..50ebcb501c 100644 --- a/gtk/gtkcomboboxtext.h +++ b/gtk/gtkcomboboxtext.h @@ -72,10 +72,6 @@ void gtk_combo_box_text_remove (GtkComboBoxText *combo_box void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box); gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); -void gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box, - gint position, - const gchar *text, - gint id); G_END_DECLS diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 4d10e36305..053e02baa5 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6660,9 +6660,11 @@ gtk_entry_set_buffer (GtkEntry *entry, * @entry: a #GtkEntry * @text_area: Return location for the text area. * - * Returns the area where the entry's text is drawn. This function is + * Gets the area where the entry's text is drawn. This function is * useful when drawing something to the entry in a draw callback. * + * If the entry is not realized, @text_area is filled with zeros. + * * See also gtk_entry_get_icon_area(). * * Since: 3.0 @@ -8111,10 +8113,13 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry) * @icon_pos: Icon position * @icon_area: Return location for the icon's area * - * Returns the area where entry's icon at @icon_pos is drawn. + * Gets the area where entry's icon at @icon_pos is drawn. * This function is useful when drawing something to the * entry in a draw callback. * + * If the entry is not realized or has no icon at the given position, + * @icon_area is filled with zeros. + * * See also gtk_entry_get_text_area() * * Since: 3.0 diff --git a/gtk/gtkgrid.h b/gtk/gtkgrid.h index 590d9cddeb..860658a0b7 100644 --- a/gtk/gtkgrid.h +++ b/gtk/gtkgrid.h @@ -74,7 +74,7 @@ void gtk_grid_attach (GtkGrid *grid, gint width, gint height); void gtk_grid_attach_next_to (GtkGrid *grid, - GtkWidget *widget, + GtkWidget *child, GtkWidget *sibling, GtkPositionType side, gint width, diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 7906bd6a70..02fe2a5f50 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -2181,6 +2181,16 @@ gtk_scrolled_window_get_preferred_width_for_height (GtkWidget *widget, GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width); } +/** + * gtk_scrolled_window_get_min_content_width: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the minimum content width of @scrolled_window, or -1 if not set. + * + * Returns: the minimum content width + * + * Since: 3.0 + */ gint gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window) { @@ -2189,9 +2199,20 @@ gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window) return scrolled_window->priv->min_content_width; } +/** + * gtk_scrolled_window_set_min_content_width: + * @scrolled_window: a #GtkScrolledWindow + * @width: the minimal content width + * + * Sets the minimum width that @scrolled_window should keep visible. + * Note that this can and (usually will) be smaller than the minimum + * size of the content. + * + * Since: 3.0 + */ void gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, - gint min_content_width) + gint width) { GtkScrolledWindowPrivate *priv; @@ -2199,9 +2220,9 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, priv = scrolled_window->priv; - if (priv->min_content_width != min_content_width) + if (priv->min_content_width != width) { - priv->min_content_width = min_content_width; + priv->min_content_width = width; gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); @@ -2209,6 +2230,16 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, } } +/** + * gtk_scrolled_window_get_min_content_height: + * @scrolled_window: a #GtkScrolledWindow + * + * Gets the minimal content height of @scrolled_window, or -1 if not set. + * + * Returns: the minimal content height + * + * Since: 3.0 + */ gint gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window) { @@ -2217,9 +2248,20 @@ gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window) return scrolled_window->priv->min_content_height; } +/** + * gtk_scrolled_window_set_min_content_height: + * @scrolled_window: a #GtkScrolledWindow + * @height: the minimal content height + * + * Sets the minimum height that @scrolled_window should keep visible. + * Note that this can and (usually will) be smaller than the minimum + * size of the content. + * + * Since: 3.0 + */ void gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window, - gint min_content_height) + gint height) { GtkScrolledWindowPrivate *priv; @@ -2227,9 +2269,9 @@ gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window, priv = scrolled_window->priv; - if (priv->min_content_height != min_content_height) + if (priv->min_content_height != height) { - priv->min_content_height = min_content_height; + priv->min_content_height = height; gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 7178aa0895..80cf51a5a9 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -934,7 +934,7 @@ gtk_table_get_homogeneous (GtkTable *table) * @columns: (out) (allow-none): return location for the number * of columns, or %NULL * - * Returns the number of rows and columns in the table. + * Gets the number of rows and columns in the table. * * Since: 2.22 **/ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 43f8c377ba..97e89f2c51 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11204,6 +11204,16 @@ gtk_widget_update_computed_expand (GtkWidget *widget) } } +/** + * gtk_widget_queue_compute_expand: + * @widget: a #GtkWidget + * + * Mark @widget as needing to recompute its expand flags. Call + * this function when setting legacy expand child properties + * on the child of a container. + * + * See gtk_widget_compute_expand(). + */ void gtk_widget_queue_compute_expand (GtkWidget *widget) { @@ -13146,6 +13156,16 @@ gtk_widget_send_focus_change (GtkWidget *widget, return res; } +/** + * gtk_widget_in_destruction: + * @widget: a #GtkWidget + * + * Returns whether the widget is currently being destroyed. + * This information can sometimes be used to avoid doing + * unnecessary work. + * + * Returns: %TRUE if @widget is being destroyed + */ gboolean gtk_widget_in_destruction (GtkWidget *widget) { diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 08202a29b6..fb63d1c4d2 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -2673,19 +2673,22 @@ void gtk_window_set_application (GtkWindow *window, GtkApplication *application) { + GtkWindowPrivate *priv; + g_return_if_fail (GTK_IS_WINDOW (window)); - if (window->priv->application != application) + priv = window->priv; + if (priv->application != application) { gtk_window_release_application (window); - window->priv->application = application; + priv->application = application; - if (window->priv->application != NULL) + if (priv->application != NULL) { - g_object_ref (window->priv->application); + g_object_ref (priv->application); - gtk_application_add_window (window->priv->application, window); + gtk_application_add_window (priv->application, window); } g_object_notify (G_OBJECT (window), "application"); |