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_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));
}
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
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));
}