/* * 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); }
void gb_paned_get_child_properties (GtkWidget *widget, GtkWidget *child, GbWidgetGetArgData *data) { gboolean shrink, resize; if (child == GTK_PANED (widget)->child1) { shrink = GTK_PANED (widget)->child1_shrink; resize = GTK_PANED (widget)->child1_resize; } else if (child == GTK_PANED (widget)->child2) { shrink = GTK_PANED (widget)->child2_shrink; resize = GTK_PANED (widget)->child2_resize; } else { /* This shouldn't happen. */ g_warning ("Couldn't find child of GtkPaned container"); return; } if (data->action == GB_SAVING) save_start_tag (data, "packing"); gb_widget_output_bool (data, Shrink, shrink); gb_widget_output_bool (data, Resize, resize); if (data->action == GB_SAVING) save_end_tag (data, "packing"); }
/* * 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_message_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GtkWidget *pixmap, *label; gchar *label_text; gint type_index; get_message_box_widgets (widget, &pixmap, &label); g_return_if_fail (pixmap != NULL); g_return_if_fail (label != NULL); type_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), MessageBoxType)); gb_widget_output_choice (data, MessageBoxType, type_index, GbMessageBoxTypeSymbols[type_index]); gtk_label_get (GTK_LABEL (label), &label_text); gb_widget_output_translatable_text (data, Message, label_text); gb_window_get_standard_properties (widget, data, Title, NULL, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass); gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes); gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide); }
/* * 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_spin_button_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gint i, update_policy; gb_widget_output_float (data, ClimbRate, GTK_SPIN_BUTTON (widget)->climb_rate); gb_widget_output_int (data, Digits, GTK_SPIN_BUTTON (widget)->digits); gb_widget_output_bool (data, Numeric, GTK_SPIN_BUTTON (widget)->numeric); /* This is a slight kludge since the spin_button's update policy is a set of flags rather than integer values */ update_policy = GTK_SPIN_BUTTON (widget)->update_policy & (GTK_UPDATE_ALWAYS | GTK_UPDATE_IF_VALID); for (i = 0; i < sizeof (GbPolicyValues) / sizeof (GbPolicyValues[0]); i++) { if (GbPolicyValues[i] == update_policy) gb_widget_output_choice (data, Policy, i, GbPolicySymbols[i]); } /* In GTK 1.1 snap_to_ticks is given its own variable. */ gb_widget_output_bool (data, Snap, GTK_SPIN_BUTTON (widget)->snap_to_ticks); gb_widget_output_bool (data, Wrap, GTK_SPIN_BUTTON (widget)->wrap); gb_widget_output_adjustment (data, Values, GTK_SPIN_BUTTON (widget)->adjustment, "adjustment"); }
/* * 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_toggle_button_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gb_button_get_standard_properties (widget, data, StockButton, Label, Icon, Relief, FocusOnClick); gb_widget_output_bool (data, State, data->widget_data->flags & GLADE_ACTIVE); gb_widget_output_bool (data, Inconsistent, GTK_TOGGLE_BUTTON (widget)->inconsistent); }
/* * 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_tool_item_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_widget_output_bool (data, VisibleHorz, gtk_object_get_data (GTK_OBJECT (widget), VisibleHorz) != NULL ? FALSE : TRUE); gb_widget_output_bool (data, VisibleVert, gtk_object_get_data (GTK_OBJECT (widget), VisibleVert) != NULL ? FALSE : TRUE); gb_widget_output_bool (data, IsImportant, gtk_tool_item_get_is_important (GTK_TOOL_ITEM (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_dialog_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_window_get_standard_properties (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, IconName, FocusOnMap, Resizable, DestroyWithParent, Icon, Role, TypeHint, SkipTaskbar, SkipPager, Decorated, Gravity, Urgency); gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes); gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide); }
/* * 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_tclist_get_properties (GtkWidget * widget, GtkWidget *child, GbWidgetGetArgData * data) { gchar buffer[1024]; gchar *pos; gboolean buffer_overrun = FALSE; gint i; if (data->action == GB_SAVING) { gb_widget_output_int (data, Cols, GTK_CLIST (widget)->columns); pos = buffer; for (i = 0; i < GTK_CLIST (widget)->columns; i++) { if (i == 0) sprintf (pos, "%i", GTK_CLIST (widget)->column[i].width); else sprintf (pos, ",%i", GTK_CLIST (widget)->column[i].width); pos += strlen (pos); /* Extra check to make sure we don't overrun the buffer. */ if (pos - buffer > 1000) { g_warning ("Buffer overflow"); buffer_overrun = TRUE; break; } } if (!buffer_overrun) gb_widget_output_string (data, ColumnWidths, buffer); } for (i = 0; i < sizeof (GbModeValues) / sizeof (GbModeValues[0]); i++) { if (GbModeValues[i] == GTK_CLIST (widget)->selection_mode) gb_widget_output_choice (data, Mode, i, GbModeSymbols[i]); } gb_widget_output_bool (data, Titles, GTK_CLIST_SHOW_TITLES (widget)); for (i = 0; i < sizeof (GbShadowValues) / sizeof (GbShadowValues[0]); i++) { if (GbShadowValues[i] == GTK_CLIST (widget)->shadow_type) gb_widget_output_choice (data, Shadow, i, GbShadowSymbols[i]); } #ifndef GTK_HAVE_FEATURES_1_1_4 for (i = 0; i < sizeof (GbPolicyValues) / sizeof (GbPolicyValues[0]); i++) { if (GbPolicyValues[i] == GTK_CLIST (widget)->hscrollbar_policy) gb_widget_output_choice (data, HPolicy, i, GbPolicySymbols[i]); } for (i = 0; i < sizeof (GbPolicyValues) / sizeof (GbPolicyValues[0]); i++) { if (GbPolicyValues[i] == GTK_CLIST (widget)->vscrollbar_policy) gb_widget_output_choice (data, VPolicy, i, GbPolicySymbols[i]); } #endif }
/* * 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_pixmap_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gboolean scaled; gint w, h; gb_widget_output_pixmap_filename (data, Filename, gtk_object_get_data (GTK_OBJECT (widget), Filename)); scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL ? TRUE : FALSE; if (data->action == GB_SHOWING) { gb_widget_output_bool (data, Scaled, scaled); property_set_sensitive (Width, scaled); property_set_sensitive (Height, scaled); } /* We only save the scaled width and height if the pixmap is scaled. */ w = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width)); if (scaled || data->action == GB_SHOWING) gb_widget_output_int (data, Width, w); h = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height)); if (scaled || data->action == GB_SHOWING) gb_widget_output_int (data, Height, h); }
/* * 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_vbox_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { if (data->action != GB_SAVING) gb_widget_output_int (data, Size, g_list_length (GTK_BOX (widget)->children)); gb_widget_output_bool (data, Homogeneous, GTK_BOX (widget)->homogeneous); gb_widget_output_int (data, Spacing, GTK_BOX (widget)->spacing); }
/* * 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_combo_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gchar *items; gboolean add_tearoffs, focus_on_click; items = gtk_object_get_data (GTK_OBJECT (widget), Items); gb_widget_output_translatable_text_in_lines (data, Items, items); g_object_get (G_OBJECT (widget), "add_tearoffs", &add_tearoffs, "focus_on_click", &focus_on_click, NULL); gb_widget_output_bool (data, AddTearoffs, add_tearoffs); gb_widget_output_bool (data, FocusOnClick, focus_on_click); }
/* * 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_radio_tool_button_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GladeFindGroupData find_data; gb_tool_button_get_standard_properties (widget, data, StockButton, Label, Icon, VisibleHorz, VisibleVert, IsImportant); gb_widget_output_bool (data, Active, data->widget_data->flags & GLADE_ACTIVE); /* If we're showing we need to display the list of groups to choose from. We walk the tree of widgets in this component, and if a widget is a radio button, we see if it has a group and if it is already in the list and if not we add it. */ if (data->action == GB_SHOWING) { GladeFindGroupsData find_groups_data; find_groups_data.groups_found = NULL; find_groups_data.group_names = NULL; gb_widget_children_foreach (widget->parent, (GtkCallback) get_radio_button_groups, &find_groups_data); find_groups_data.group_names = g_list_prepend (find_groups_data.group_names, _("New Group")); property_set_combo_strings (Group, find_groups_data.group_names); g_list_free (find_groups_data.groups_found); g_list_free (find_groups_data.group_names); } find_data.group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (widget)); find_data.found_widget = NULL; gb_widget_children_foreach (widget->parent, (GtkCallback) find_radio_group, &find_data); if (find_data.found_widget) { /* If we are saving, we don't output the group if this widget is the first widget in the group. */ if (data->action == GB_SHOWING || find_data.found_widget != widget) { const char *name; name = gtk_widget_get_name (find_data.found_widget); gb_widget_output_combo (data, Group, name); } } else { g_warning ("Radiotoolbutton has no group"); gb_widget_output_combo (data, Group, ""); } }
/* * 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_radio_button_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gboolean is_toolbar_button; is_toolbar_button = gb_toolbar_is_toolbar_button (widget); if (is_toolbar_button) { gb_toolbar_output_child_label (widget, data, Label); gb_toolbar_output_child_icon (widget, data, Icon); } else { gb_widget_output_child_label (widget, data, Label); } gb_widget_output_bool (data, State, data->widget_data->flags & GLADE_ACTIVE); if (!is_toolbar_button) { gb_widget_output_bool (data, Indicator, GTK_TOGGLE_BUTTON (widget)->draw_indicator); } /* If we're showing we need to display the list of groups to choose from. We walk the tree of widgets in this component, and if a widget is a radio button, we see if it has a group and if it is already in the list and if not we add it. */ if (data->action == GB_SHOWING) { GList *groups = NULL; get_radio_button_groups (gtk_widget_get_toplevel (widget), &groups); property_set_combo_strings (Group, groups); g_list_free (groups); property_set_visible (Icon, is_toolbar_button); property_set_visible (Indicator, !is_toolbar_button); } gb_widget_output_combo (data, Group, gtk_object_get_data (GTK_OBJECT (widget), Group)); }
/* * 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_toggle_tool_button_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_tool_button_get_standard_properties (widget, data, StockButton, Label, Icon, VisibleHorz, VisibleVert, IsImportant); gb_widget_output_bool (data, Active, data->widget_data->flags & GLADE_ACTIVE); }
/* * 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_app_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gb_window_get_standard_properties (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, IconName, FocusOnMap, Resizable, DestroyWithParent, Icon, Role, TypeHint, SkipTaskbar, SkipPager, Decorated, Gravity, Urgency); if (data->action == GB_SHOWING) { gb_widget_output_bool (data, StatusBar, GNOME_APP (widget)->statusbar != NULL ? TRUE : FALSE); } gb_widget_output_bool (data, EnableLayoutConfig, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), EnableLayoutConfig))); }
/* * 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_get_properties (GtkWidget *widget, GbWidgetGetArgData *data) { gboolean show_help; g_object_get (G_OBJECT (widget), "show-help", &show_help, NULL); gb_widget_output_bool (data, ShowHelp, show_help); }
/* * 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_dock_item_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gint i; if (BONOBO_DOCK_ITEM (widget)->is_floating) { /* Orientation is only relevant when floating. */ for (i = 0; i < GladeOrientationSize; i++) { if (GladeOrientationValues[i] == BONOBO_DOCK_ITEM (widget)->orientation) { gb_widget_output_choice (data, Orientation, i, GladeOrientationSymbols[i]); } } } if (data->action == GB_SHOWING) { gb_widget_output_bool (data, Locked, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_LOCKED); gb_widget_output_bool (data, Exclusive, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_EXCLUSIVE); gb_widget_output_bool (data, NeverFloating, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING); gb_widget_output_bool (data, NeverVertical, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL); gb_widget_output_bool (data, NeverHorizontal, BONOBO_DOCK_ITEM (widget)->behavior & BONOBO_DOCK_ITEM_BEH_NEVER_HORIZONTAL); } for (i = 0; i < sizeof (GbShadowValues) / sizeof (GbShadowValues[0]); i++) { if (GbShadowValues[i] == BONOBO_DOCK_ITEM (widget)->shadow_type) gb_widget_output_choice (data, ShadowType, i, GbShadowSymbols[i]); } if (data->action == GB_SHOWING) { /* The orientation is only useful for floating items. */ property_set_sensitive (Orientation, BONOBO_DOCK_ITEM (widget)->is_floating); } }
void gb_box_get_child_properties (GtkWidget *widget, GtkWidget *child, GbWidgetGetArgData *data) { gboolean expand, fill; gint position; guint padding; GtkPackType pack_type; if (data->action == GB_SAVING) save_start_tag (data, "packing"); if (data->action == GB_SHOWING) { position = glade_util_get_box_pos (GTK_BOX (widget), child); gb_widget_output_int (data, GbPosition, position); } gtk_box_query_child_packing (GTK_BOX (widget), child, &expand, &fill, &padding, &pack_type); gb_widget_output_int (data, GbPadding, padding); gb_widget_output_bool (data, GbExpand, expand); gb_widget_output_bool (data, GbFill, fill); if (data->action == GB_SAVING) { /* Save pack type as an enum symbol rather than a bool */ if (pack_type == GTK_PACK_END) { gb_widget_output_string (data, GbPack, "GTK_PACK_END"); } } else { gb_widget_output_bool (data, GbPack, pack_type == GTK_PACK_START); } if (data->action == GB_SAVING) save_end_tag (data, "packing"); }
/* * 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_selection_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gb_window_get_standard_properties (widget, data, Title, Type, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass, Resizable, DestroyWithParent, Icon); gb_widget_output_bool (data, FileOps, GTK_FILE_SELECTION (widget)->fileop_c_dir != NULL); }
/* * 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_combo_get_properties (GtkWidget * widget, GbWidgetGetArgData * data) { gb_widget_output_bool (data, ValueInList, gtk_object_get_data (GTK_OBJECT (widget), ValueInList) != NULL ? TRUE : FALSE); gb_widget_output_bool (data, OKIfEmpty, gtk_object_get_data (GTK_OBJECT (widget), OKIfEmpty) != NULL ? TRUE : FALSE); gb_widget_output_bool (data, Case, GTK_COMBO (widget)->case_sensitive); gb_widget_output_bool (data, Arrows, GTK_COMBO (widget)->use_arrows); gb_widget_output_bool (data, Always, GTK_COMBO (widget)->use_arrows_always); if (is_simple_combo (widget) >= 0) { GString *items; items = g_string_new (""); gtk_container_foreach (GTK_CONTAINER (GTK_COMBO (widget)->list), (GtkCallback) add_label, items); gb_widget_output_translatable_text_in_lines (data, Items, items->str); g_string_free (items, TRUE); } }
/* * 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_href_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { gchar *uri, *label; g_object_get (G_OBJECT (widget), "url", &uri, "text", &label, NULL); gb_widget_output_string (data, HRefURL, uri); gb_widget_output_translatable_text (data, HRefLabel, label); g_free (uri); g_free (label); 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_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); }
/* * 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_statusbar_get_properties(GtkWidget *widget, GbWidgetGetArgData *data) { gb_widget_output_bool (data, ResizeGrip, GTK_STATUSBAR (widget)->has_resize_grip); }
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)); }
void gb_label_get_standard_properties (GtkWidget * widget, GbWidgetGetArgData * data, const char *label_p, const char *use_underline_p, const char *use_markup_p, const char *justify_p, const char *wrap_p, const char *selectable_p, const char *xalign_p, const char *yalign_p, const char *xpad_p, const char *ypad_p, const char *focus_target_p) { const gchar *label_text; gint i; label_text = gtk_label_get_label (GTK_LABEL (widget)); gb_widget_output_translatable_text (data, label_p, label_text); gb_widget_output_bool (data, use_underline_p, gtk_label_get_use_underline (GTK_LABEL (widget))); gb_widget_output_bool (data, use_markup_p, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), use_markup_p))); for (i = 0; i < sizeof (GbJustifyValues) / sizeof (GbJustifyValues[0]); i++) { if (GbJustifyValues[i] == GTK_LABEL (widget)->jtype) gb_widget_output_choice (data, justify_p, i, GbJustifySymbols[i]); } gb_widget_output_bool (data, wrap_p, GTK_LABEL (widget)->wrap); gb_widget_output_bool (data, selectable_p, gtk_label_get_selectable (GTK_LABEL (widget))); gb_widget_output_float (data, xalign_p, GTK_MISC (widget)->xalign); gb_widget_output_float (data, yalign_p, GTK_MISC (widget)->yalign); gb_widget_output_int (data, xpad_p, GTK_MISC (widget)->xpad); gb_widget_output_int (data, ypad_p, GTK_MISC (widget)->ypad); /* Labels not in buttons may have a focus target widget. */ if (!gb_label_find_mnemonic_widget (widget)) { gchar *accel_target; accel_target = gtk_object_get_data (GTK_OBJECT (widget), focus_target_p); /* If we're showing we need to display the list of possible focus target widgets. We walk the tree of widgets in this component, and if a widget has CAN_FOCUS set, we add it to the list. */ if (data->action == GB_SHOWING) { GList *focus_targets = NULL, *standard_items = NULL; GtkWidget *item, *combo; property_set_visible (focus_target_p, TRUE); gb_label_get_focus_targets (gtk_widget_get_toplevel (widget), &focus_targets); property_set_combo_strings (focus_target_p, focus_targets); g_list_free (focus_targets); combo = property_get_value_widget (focus_target_p); item = gtk_list_item_new_with_label (_("Auto")); gtk_widget_show (item); standard_items = g_list_append (standard_items, item); item = gtk_list_item_new (); gtk_widget_set_sensitive (item, FALSE); gtk_widget_show (item); standard_items = g_list_append (standard_items, item); gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (item), ""); gtk_list_prepend_items (GTK_LIST (GTK_COMBO (combo)->list), standard_items); if (!accel_target) { accel_target = _("Auto"); } gb_widget_output_combo (data, focus_target_p, accel_target); } else { /* When saving, we only save the property if it has been set. */ if (accel_target) { /* First check that the widget is still there, and if it isn't just skip it. */ if (glade_util_find_widget (gtk_widget_get_toplevel (widget), accel_target)) { gb_widget_output_combo (data, focus_target_p, accel_target); } } else { /* If no target has been set, and the label has an underlined key, we try to find a default target and save that. */ if (gtk_label_get_use_underline (GTK_LABEL (widget))) { GtkWidget *accel_target; accel_target = glade_util_find_default_accelerator_target (widget); if (accel_target) { gb_widget_output_string (data, focus_target_p, gtk_widget_get_name (accel_target)); } } } } } else { if (data->action == GB_SHOWING) { property_set_visible (focus_target_p, FALSE); } } }