/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_file_chooser_button_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gchar *title; GtkFileChooserAction action; gboolean local_only, show_hidden, confirm; gint i, width_chars; g_object_get (widget, "title", &title, "action", &action, "local_only", &local_only, "show_hidden", &show_hidden, "do_overwrite_confirmation", &confirm, "width_chars", &width_chars, NULL); gb_widget_output_translatable_string (data, Title, title); g_free (title); for (i = 0; i < sizeof (GbActionValues) / sizeof (GbActionValues[0]); i++) { if (GbActionValues[i] == action) gb_widget_output_choice (data, Action, i, GbActionSymbols[i]); } gb_widget_output_bool (data, LocalOnly, local_only); gb_widget_output_bool (data, ShowHidden, show_hidden); gb_widget_output_bool (data, Confirm, confirm); gb_widget_output_int (data, WidthChars, width_chars); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_icon_entry_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_widget_output_translatable_string (data, Title, gtk_object_get_data (GTK_OBJECT (widget), Title)); gb_widget_output_string (data, HistoryID, gtk_object_get_data (GTK_OBJECT (widget), HistoryID)); gb_widget_output_int (data, MaxSaved, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), MaxSaved))); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_font_selection_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { const gchar *preview_text; preview_text = gtk_font_selection_get_preview_text (GTK_FONT_SELECTION (widget)); gb_widget_output_translatable_string (data, PreviewText, preview_text); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_color_picker_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_widget_output_bool (data, Dither, gnome_color_picker_get_dither (GNOME_COLOR_PICKER (widget))); gb_widget_output_bool (data, UseAlpha, gnome_color_picker_get_use_alpha (GNOME_COLOR_PICKER (widget))); gb_widget_output_translatable_string (data, Title, gnome_color_picker_get_title (GNOME_COLOR_PICKER (widget))); gb_widget_output_bool (data, FocusOnClick, gtk_button_get_focus_on_click (GTK_BUTTON (widget))); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_druid_page_standard_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GnomeDruidPageStandard *page; GdkColor *title_color, *background_color, *logo_background_color; gboolean title_color_set, background_color_set, logo_background_color_set; page = GNOME_DRUID_PAGE_STANDARD (widget); /* We do this to make sure the colors are set. */ gtk_widget_ensure_style (widget); gb_widget_output_translatable_string (data, Title, page->title); g_object_get (G_OBJECT (widget), "title-foreground-set", &title_color_set, "title-foreground-gdk", &title_color, "background-set", &background_color_set, "background-gdk", &background_color, "logo-background-set", &logo_background_color_set, "logo-background-gdk", &logo_background_color, NULL); if (data->action == GB_SHOWING || title_color_set) gb_widget_output_color (data, TitleColor, title_color); if (data->action == GB_SHOWING || background_color_set) gb_widget_output_color (data, BackgroundColor, background_color); if (data->action == GB_SHOWING || logo_background_color_set) gb_widget_output_color (data, LogoBackgroundColor, logo_background_color); gdk_color_free (title_color); gdk_color_free (background_color); gdk_color_free (logo_background_color); /* FIXME: GNOME 2 bug workaround. It doesn't install the properties for these, so we have to do it ourselves. */ if (data->action == GB_SHOWING || gtk_object_get_data (GTK_OBJECT (widget), ContentsBackgroundColor)) gb_widget_output_color (data, ContentsBackgroundColor, &page->contents_background); gb_widget_output_pixmap_filename (data, LogoImage, gtk_object_get_data (GTK_OBJECT (widget), LogoImage)); gb_widget_output_pixmap_filename (data, TopWatermark, gtk_object_get_data (GTK_OBJECT (widget), TopWatermark)); }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_bonobo_control_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { Bonobo_PropertyBag pb = control_get_pb (widget); char *moniker = gtk_object_get_data (GTK_OBJECT (widget), Moniker); GList *key_list, *names; g_assert (moniker); if (!pb) return; /* We save the moniker in the XML, though we don't show it in the property editor. */ if (data->action == GB_SAVING) { save_string (data, Moniker, moniker); } key_list = bonobo_pbclient_get_keys (pb, NULL); for (names = key_list; names; names = names->next) { CORBA_TypeCode tc; char *prop = create_prop_name (moniker, names->data); tc = bonobo_pbclient_get_type (pb, names->data, NULL); switch (tc->kind) { case CORBA_tk_boolean: gb_widget_output_bool (data, prop, bonobo_pbclient_get_boolean (pb, names->data, NULL)); break; case CORBA_tk_string: { char *str = bonobo_pbclient_get_string (pb, names->data, NULL); gb_widget_output_translatable_string (data, prop, str); g_free (str); break; } case CORBA_tk_ulong: gb_widget_output_int (data, prop, bonobo_pbclient_get_ulong (pb, names->data, NULL)); break; case CORBA_tk_long: gb_widget_output_int (data, prop, bonobo_pbclient_get_long (pb, names->data, NULL)); break; case CORBA_tk_short: gb_widget_output_int (data, prop, bonobo_pbclient_get_short (pb, names->data, NULL)); break; case CORBA_tk_ushort: gb_widget_output_int (data, prop, bonobo_pbclient_get_ushort (pb, names->data, NULL)); break; case CORBA_tk_float: gb_widget_output_float (data, prop, bonobo_pbclient_get_float (pb, names->data, NULL)); break; case CORBA_tk_double: gb_widget_output_float (data, prop, bonobo_pbclient_get_double (pb, names->data, NULL)); break; default: g_warning ("Unhandled type %d", tc->kind); break; } g_free (prop); } bonobo_pbclient_free_keys (key_list); }
void gb_window_get_standard_properties (GtkWidget * widget, GbWidgetGetArgData * data, gchar *title_p, gchar *type_p, gchar *position_p, gchar *modal_p, gchar *default_width_p, gchar *default_height_p, gchar *shrink_p, gchar *grow_p, gchar *auto_shrink_p, gchar *wmname_p, gchar *wmclass_p, gchar *resizable_p, gchar *destroy_with_parent_p, gchar *icon_p) { gint type, position, default_width, default_height; if (title_p) gb_widget_output_translatable_string (data, title_p, GTK_WINDOW (widget)->title); /* The type is stored in the object datalist as we can't change it after the window is realized. It will default to 0, which is OK. */ if (type_p) { type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), type_p)); gb_widget_output_choice (data, type_p, type, GbTypeSymbols[type]); } /* The position is stored in the object datalist so that it doesn't affect the displaying of the window within Glade. It will default to 0, i.e. GTK_WIN_POS_NONE, which is OK. */ if (position_p) { position = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), position_p)); gb_widget_output_choice (data, position_p, position, GbPositionSymbols[position]); } if (modal_p) { gb_widget_output_bool (data, modal_p, gtk_object_get_data (GTK_OBJECT (widget), modal_p) != NULL ? TRUE : FALSE); } if (default_width_p && default_height_p) { default_width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), DefaultWidth)); gb_widget_output_optional_int (data, default_width_p, default_width, default_width != 0 ? TRUE : FALSE); default_height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), DefaultHeight)); gb_widget_output_optional_int (data, default_height_p, default_height, default_height != 0 ? TRUE : FALSE); } #if 0 /* These are deprecated. */ if (grow_p && shrink_p) { gb_widget_output_bool (data, grow_p, GTK_WINDOW (widget)->allow_grow); gb_widget_output_bool (data, shrink_p, GTK_WINDOW (widget)->allow_shrink); } #endif /* These are stored in the object hash since we can't set them after the window is realized. */ #if 0 /* These aren't necessary, and have been used incorrectly for ages. */ if (wmname_p) gb_widget_output_string (data, wmname_p, gtk_object_get_data (GTK_OBJECT (widget), wmname_p)); if (wmclass_p) gb_widget_output_string (data, wmclass_p, gtk_object_get_data (GTK_OBJECT (widget), wmclass_p)); #endif if (resizable_p) gb_widget_output_bool (data, resizable_p, gtk_window_get_resizable (GTK_WINDOW (widget))); if (destroy_with_parent_p) gb_widget_output_bool (data, destroy_with_parent_p, gtk_window_get_destroy_with_parent (GTK_WINDOW (widget))); if (icon_p) gb_widget_output_pixmap_filename (data, icon_p, gtk_object_get_data (GTK_OBJECT (widget), icon_p)); }