Example #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_hbutton_box_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
    GtkButtonBoxStyle layout;
    gint i, spacing;
    gboolean spacing_visible = FALSE;

    if (data->action != GB_SAVING)
        gb_widget_output_int (data, Size, g_list_length (GTK_BOX (widget)->children));

    layout = gtk_button_box_get_layout (GTK_BUTTON_BOX (widget));
    for (i = 0; i < sizeof (GbLayoutValues) / sizeof (GbLayoutValues[0]); i++)
    {
        if (GbLayoutValues[i] == layout)
            gb_widget_output_choice (data, Layout, i, GbLayoutSymbols[i]);
    }

    if (!gb_hbutton_box_is_dialog_action_area (widget))
    {
        spacing_visible = TRUE;
        spacing = gtk_box_get_spacing (GTK_BOX (widget));
        gb_widget_output_int (data, Spacing, spacing);
    }

    if (data->action == GB_SHOWING)
    {
        property_set_visible (Spacing, spacing_visible);
    }
}
Example #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_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);
}
Example #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_custom_get_properties (GtkWidget *widget, GbWidgetGetArgData * data)
{
    gchar *string1, *string2;

    gb_widget_output_string (data, CreationFunction, gtk_object_get_data (GTK_OBJECT (widget), CreationFunction));

    string1 = gtk_object_get_data (GTK_OBJECT (widget), String1);
    string2 = gtk_object_get_data (GTK_OBJECT (widget), String2);

    /* For empty strings output NULL (i.e. don't save in the XML). */
    if (string1 && *string1 == '\0')
        string1 = NULL;
    if (string2 && *string2 == '\0')
        string2 = NULL;

    gb_widget_output_string (data, String1, string1);
    gb_widget_output_string (data, String2, string2);

    gb_widget_output_int (data, Int1, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Int1)));
    gb_widget_output_int (data, Int2, GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Int2)));

    /* When saving we also save the last modification time. */
    if (data->action == GB_SAVING)
    {
        time_t last_mod_time;

        last_mod_time = gb_custom_get_last_mod_time (widget);
        if (last_mod_time != 0)
        {
            save_date (data, LastModTime, last_mod_time);
        }
    }
}
Example #4
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_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);
}
Example #5
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_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
}
Example #6
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_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);
}
Example #7
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_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");
}
Example #8
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_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)));
}
Example #9
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_option_menu_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  if (data->action == GB_SAVING)
    gb_widget_output_int (data, History, 
			  gtk_option_menu_get_history (GTK_OPTION_MENU (widget)));
}
Example #10
0
/* SPECIAL CODE: "placement", "band", "position", "offset" and "behavior"
   are now packing properties, so we have this special function to save
   them, which is called directly in gb_widget_save(). */
void
gb_bonobo_dock_item_save_packing_properties (GtkWidget *parent,
					     GtkWidget *widget,
					     GbWidgetGetArgData * data)
{
  char *behavior;

  save_start_tag (data, "packing");

  if (BONOBO_DOCK_ITEM (widget)->is_floating)
    {
      gb_widget_output_string (data, Placement, "BONOBO_DOCK_FLOATING");
    }
  else
    {
      BonoboDockPlacement placement;
      gint band_num, position, offset, idx;

      if (gb_bonobo_dock_item_find_position (BONOBO_DOCK_ITEM (widget),
					     &placement, &band_num,
					     &position, &offset))
	{
	  idx = glade_util_int_array_index (GladePlacementValues,
					    GladePlacementSize,
					    placement);
	  if (idx != -1)
	    gb_widget_output_string (data, Placement,
				     GladePlacementSymbols[idx]);

	  gb_widget_output_int (data, BandNum, band_num);
	  gb_widget_output_int (data, Position, position);
	  gb_widget_output_int (data, Offset, offset);
	}
      else
	{
	  g_warning ("Dock band not found");
	}
    }

  behavior = glade_util_string_from_flags (BONOBO_TYPE_DOCK_ITEM_BEHAVIOR,
					   BONOBO_DOCK_ITEM (widget)->behavior);
  save_string (data, Behavior, behavior);
  g_free (behavior);

  save_end_tag (data, "packing");
}
Example #11
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_vbutton_box_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  GtkButtonBoxStyle layout;
  gint i, spacing;

  if (data->action != GB_SAVING)
    gb_widget_output_int (data, Size, g_list_length (GTK_BOX (widget)->children));

  layout = gtk_button_box_get_layout (GTK_BUTTON_BOX (widget));
  for (i = 0; i < sizeof (GbLayoutValues) / sizeof (GbLayoutValues[0]); i++)
    {
      if (GbLayoutValues[i] == layout)
	gb_widget_output_choice (data, Layout, i, GbLayoutSymbols[i]);
    }

  spacing = gtk_box_get_spacing (GTK_BOX (widget));
  gb_widget_output_int (data, Spacing, spacing);
}
Example #12
0
/* Shows or saves the child properties of a child of a GtkFixed. */
void
gb_fixed_get_child_properties (GtkWidget *widget, GtkWidget *child,
			       GbWidgetGetArgData *data)
{
  gint x, y;

  if (data->action == GB_SAVING)
    save_start_tag (data, "packing");

  gtk_container_child_get (GTK_CONTAINER (widget), child,
			   "x", &x,
			   "y", &y,
			   NULL);

  gb_widget_output_int (data, GladeFixedChildX, x);
  gb_widget_output_int (data, GladeFixedChildY, y);

  if (data->action == GB_SAVING)
    save_end_tag (data, "packing");
}
Example #13
0
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");
}
Example #14
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_option_menu_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  GbAddLabelData add_label_data;
  gchar items[ITEMS_BUFFER_SIZE];

  /* Clear the buffer and make sure it's seen as valid */
  items[0] = '\0';
  add_label_data.items = items;
  add_label_data.option_menu = widget;
  add_label_data.buffer_overflow = FALSE;
  add_label_data.index = 0;
  add_label_data.selected_index = 0;
  gtk_container_foreach (GTK_CONTAINER (GTK_OPTION_MENU (widget)->menu),
			 (GtkCallback) add_label, &add_label_data);
  if (add_label_data.buffer_overflow)
    {
      gb_widget_output_text (data, Items, "");
      gb_widget_output_int (data, Choice, 0);
      if (data->action == GB_SHOWING)
	{
	  property_set_sensitive (Items, FALSE);
	  property_set_sensitive (Choice, FALSE);
	}
    }
  else
    {
      gb_widget_output_translatable_text_in_lines (data, Items, items);
      gb_widget_output_int (data, Choice, add_label_data.selected_index);
      if (data->action == GB_SHOWING)
	{
	  property_set_sensitive (Items, TRUE);
	  property_set_sensitive (Choice, TRUE);
	}
    }
}
Example #15
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_vbutton_box_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  GtkButtonBoxStyle layout;
  gint i, spacing, min_width, min_height, ipad_x, ipad_y;
  gint default_spacing;
  gint default_min_width, default_min_height, default_ipad_x, default_ipad_y;

  if (data->action != GB_SAVING)
    gb_widget_output_int (data, Size, g_list_length (GTK_BOX (widget)->children));

  layout = gtk_button_box_get_layout (GTK_BUTTON_BOX (widget));
  for (i = 0; i < sizeof (GbLayoutValues) / sizeof (GbLayoutValues[0]); i++)
    {
      if (GbLayoutValues[i] == layout)
	gb_widget_output_choice (data, Layout, i, GbLayoutSymbols[i]);
    }

  spacing = gtk_button_box_get_spacing (GTK_BUTTON_BOX (widget));
  default_spacing = gtk_vbutton_box_get_spacing_default ();
  if (spacing == GTK_BUTTONBOX_DEFAULT)
    spacing = default_spacing;
  gb_widget_output_int (data, Spacing, spacing);

  gtk_button_box_get_child_size_default (&default_min_width,
					 &default_min_height);
  gtk_button_box_get_child_size (GTK_BUTTON_BOX (widget), &min_width,
				 &min_height);
  if (min_width == GTK_BUTTONBOX_DEFAULT)
    min_width = default_min_width;
  if (min_height == GTK_BUTTONBOX_DEFAULT)
    min_height = default_min_height;
  gb_widget_output_int (data, Width, min_width);
  gb_widget_output_int (data, Height, min_height);

  gtk_button_box_get_child_ipadding_default (&default_ipad_x, &default_ipad_y);
  gtk_button_box_get_child_ipadding (GTK_BUTTON_BOX (widget), &ipad_x, &ipad_y);
  if (ipad_x == GTK_BUTTONBOX_DEFAULT)
    ipad_x = default_ipad_x;
  if (ipad_y == GTK_BUTTONBOX_DEFAULT)
    ipad_y = default_ipad_y;
  gb_widget_output_int (data, XPad, ipad_x);
  gb_widget_output_int (data, YPad, ipad_y);
}
Example #16
0
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);
	}
    }
}
Example #17
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_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);
}
Example #18
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_image_get_properties (GtkWidget * widget, GbWidgetGetArgData * data)
{
  gchar *icon = gtk_object_get_data (GTK_OBJECT (widget), GladeIconKey);
  gchar *icon_name = NULL;
  gboolean is_stock_icon, is_named_icon = FALSE;
  gint i, pixel_size;
  GtkImageType storage_type;

  storage_type = gtk_image_get_storage_type (GTK_IMAGE (widget));
  pixel_size = gtk_image_get_pixel_size (GTK_IMAGE (widget));

  is_stock_icon = glade_util_check_is_stock_id (icon);

  if (storage_type == GTK_IMAGE_ICON_NAME)
    {
      g_object_get (widget,
		    "icon_name", &icon_name,
		    NULL);
      if (icon_name && *icon_name)
	is_named_icon = TRUE;
    }

  if (data->action == GB_SAVING)
    {
      /* When saving we want to use "stock" or "pixbuf", depending on whether
	 it is a stock icon or an oridinary pixmap file. */
      if (is_stock_icon)
	gb_widget_output_icon (data, "stock", icon);
      else
	gb_widget_output_icon (data, "pixbuf", icon);
    }
  else
    {
      gb_widget_output_icon (data, Icon, icon);
    }

  if (is_stock_icon || is_named_icon)
    {
      if (data->action == GB_SHOWING)
	{
	  for (i = 0; i < GladeIconSizeChoicesSize; i++)
	    {
	      if (GladeIconSizeValues[i] == GTK_IMAGE (widget)->icon_size)
		gb_widget_output_choice (data, IconSize, i,
					 GladeIconSizeSymbols[i]);
	    }

	  check_visible_sizes (icon, is_named_icon);
	}
      else
	{
	  /* We have to save the size as an integer, which sucks a bit.
	     The integer is the GtkIconSize enum value, not the actual size.*/
	  if (is_stock_icon || pixel_size == -1)
	    gb_widget_output_int (data, IconSize,
				  GTK_IMAGE (widget)->icon_size);
	}
    }

  gb_widget_output_named_icon (data, IconName, icon_name);

  /* The icon size only applies to stock icons or named icons.
     The pixel size only applies to named icons. */
  if (data->action == GB_SHOWING)
    {
      property_set_sensitive (IconSize, is_stock_icon || is_named_icon);
      property_set_sensitive (PixelSize, is_named_icon);
    }

  /* We only want to save the pixel size for named icons, and only if it is
     not -1. */
  if (data->action == GB_SHOWING
      || (storage_type == GTK_IMAGE_ICON_NAME && pixel_size != -1))
    gb_widget_output_int (data, PixelSize, pixel_size);

  gb_widget_output_float (data, XAlign, GTK_MISC (widget)->xalign);
  gb_widget_output_float (data, YAlign, GTK_MISC (widget)->yalign);
  gb_widget_output_int (data, XPad, GTK_MISC (widget)->xpad);
  gb_widget_output_int (data, YPad, GTK_MISC (widget)->ypad);
}