Exemplo n.º 1
0
/*
 * 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_menu_item_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  gboolean output_label = TRUE;

  /* We only support saving the properties here. */
  if (data->action != GB_SAVING)
    return;

  /* If we are saving, we check for a stock Gnome menu item, and if so, we
     just save that. GTK+ stock items are all GtkImageMenuItems, so we don't
     have to worry about those here. */
#ifdef USE_GNOME
  if (glade_project_get_gnome_support (data->project))
    {
      gint stock_item_index;

      stock_item_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), GladeMenuItemStockIndexKey));
      /* The 'New' item is special. If it has a child menu, it must be a
	 GNOMEUIINFO_MENU_NEW_SUBTREE. If not, it is a
	 GNOMEUIINFO_MENU_NEW_ITEM, in which case the label is also output. */
      if (stock_item_index == GladeStockMenuItemNew)
	{
	  if (GTK_MENU_ITEM (widget)->submenu)
	    {
	      gb_widget_output_string (data, "stock_item",
				       "GNOMEUIINFO_MENU_NEW_SUBTREE");
	      output_label = FALSE;
	    }
	  else
	    {
	      gb_widget_output_string (data, "stock_item",
				       "GNOMEUIINFO_MENU_NEW_ITEM");
	    }
	}
      else if (stock_item_index != 0)
	{
	  gb_widget_output_string (data, "stock_item", GladeStockMenuItemSymbols[stock_item_index]);
	  output_label = FALSE;
	}
    }
#endif

  if (output_label)
    gb_widget_output_child_label (widget, data, Label);
}
Exemplo n.º 2
0
/*
 * 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));
}
Exemplo n.º 3
0
/*
 * 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_list_item_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  gb_widget_output_child_label (widget, data, Label);
}