Esempio n. 1
0
static GObject * entry_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	EntryDialog * self;
	parent_class = G_OBJECT_CLASS (entry_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = ENTRY_DIALOG (obj);
	{
		GtkHBox* _hbox0;
		GtkHBox* _tmp0_;
		GtkLabel* _tmp1_;
		GtkEntry* _tmp2_;
		GtkVBox* _tmp3_;
		GtkVBox* _tmp4_;
		_hbox0 = NULL;
		_hbox0 = (_tmp0_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 10)), _g_object_unref0 (_hbox0), _tmp0_);
		self->priv->label = (_tmp1_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic ("Input:")), _g_object_unref0 (self->priv->label), _tmp1_);
		self->priv->entry = (_tmp2_ = g_object_ref_sink ((GtkEntry*) gtk_entry_new ()), _g_object_unref0 (self->priv->entry), _tmp2_);
		gtk_window_set_title ((GtkWindow*) self, "gradare dialog");
		gtk_dialog_set_has_separator ((GtkDialog*) self, FALSE);
		gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
		g_object_set ((GtkWindow*) self, "default-width", 300, NULL);
		g_object_set ((GtkWindow*) self, "default-height", 80, NULL);
		g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _entry_dialog_on_response_gtk_dialog_response, self, 0);
		g_signal_connect ((GtkObject*) self, "destroy", (GCallback) _gtk_main_quit_gtk_object_destroy, NULL);
		gtk_label_set_mnemonic_widget (self->priv->label, (GtkWidget*) self->priv->entry);
		gtk_box_pack_start ((GtkBox*) _hbox0, (GtkWidget*) self->priv->label, FALSE, TRUE, (guint) 0);
		gtk_container_add ((GtkContainer*) _hbox0, (GtkWidget*) self->priv->entry);
		gtk_box_pack_start ((GtkBox*) (_tmp3_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp3_) ? ((GtkVBox*) _tmp3_) : NULL), (GtkWidget*) _hbox0, FALSE, TRUE, (guint) 0);
		gtk_box_set_spacing ((GtkBox*) (_tmp4_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp4_) ? ((GtkVBox*) _tmp4_) : NULL), 10);
		_g_object_unref0 (_hbox0);
	}
	return obj;
}
GtkWidget *
app_resizer_new (GtkVBox * child, gint initial_num_columns, gboolean homogeneous,
	AppShellData * app_data)
{
	AppResizer *widget;

	g_assert (child != NULL);
	g_assert (GTK_IS_VBOX (child));

	widget = g_object_new (APP_RESIZER_TYPE, NULL);
	widget->cached_element_width = -1;
	widget->cur_num_cols = initial_num_columns;
	widget->table_elements_homogeneous = homogeneous;
	widget->setting_style = FALSE;
	widget->app_data = app_data;

#if GTK_CHECK_VERSION (3, 0, 0)
	g_signal_connect (G_OBJECT (widget), "draw", G_CALLBACK (app_resizer_paint_window), app_data);
#else
	g_signal_connect (G_OBJECT (widget), "expose-event", G_CALLBACK (app_resizer_paint_window), app_data);
#endif

	gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (child));
	widget->child = child;

	return GTK_WIDGET (widget);
}
Esempio n. 3
0
static void
psppire_dialog_get_property (GObject         *object,
			     guint            prop_id,
			     GValue          *value,
			     GParamSpec      *pspec)
{
  PsppireDialog *dialog = PSPPIRE_DIALOG (object);

  switch (prop_id)
    {
    case PROP_ORIENTATION:
      {
	if ( GTK_IS_VBOX (dialog->box) || GTK_VPANED (dialog->box))
	  g_value_set_enum (value, PSPPIRE_VERTICAL);
	else if ( GTK_IS_HBOX (dialog->box) || GTK_HPANED (dialog->box))
	  g_value_set_enum (value, PSPPIRE_HORIZONTAL);
	else if ( GTK_IS_TABLE (dialog->box))
	  g_value_set_enum (value, PSPPIRE_TABULAR);
      }
      break;
    case PROP_SLIDING:
      g_value_set_boolean (value, dialog->slidable);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    };
}
Esempio n. 4
0
/* From contacts src/contacts-utils.c */
static GList *
contacts_set_widget_desensitive_recurse (GtkWidget *widget, GList **widgets)
{
	if (GTK_IS_WIDGET (widget)) {
		if (GTK_WIDGET_SENSITIVE (widget) &&
		    GTK_WIDGET_VISIBLE (widget)) {
			gtk_widget_set_sensitive (widget, FALSE);
			*widgets = g_list_append (*widgets, widget);
		}
		
		if (GTK_IS_TABLE (widget) || GTK_IS_HBOX (widget) ||
		    GTK_IS_VBOX (widget) || GTK_IS_EVENT_BOX (widget)) {
			GList *c, *children = gtk_container_get_children (
				GTK_CONTAINER (widget));
			
			for (c = children; c; c = c->next) {
				contacts_set_widget_desensitive_recurse (
					c->data, widgets);
			}
			g_list_free (children);
		}
	}
	
	return *widgets;
}
Esempio n. 5
0
/* This tries to find the pixmap and label in the message box. */
static void
get_message_box_widgets (GtkWidget *dialog,
			 GtkWidget **pixmap,
			 GtkWidget **label)
{
  GtkWidget *vbox, *hbox;
  GtkBoxChild *child;
  GList *elem;

  *pixmap = NULL;
  *label = NULL;

  vbox = GNOME_DIALOG (dialog)->vbox;
  if (!vbox || !GTK_IS_VBOX (vbox))
    return;

  elem = GTK_BOX (vbox)->children;
  child = (GtkBoxChild*)elem->data;
  if (!child || !GTK_IS_HBOX (child->widget))
    return;
  hbox = child->widget;

  elem = GTK_BOX (hbox)->children;
  while (elem)
    {
      child = (GtkBoxChild*)elem->data;
      if (GTK_IS_LABEL (child->widget))
	*label = child->widget;
      if (GNOME_IS_PIXMAP (child->widget))
	*pixmap = child->widget;

      elem = elem->next;
    }
}
Esempio n. 6
0
static void
change_orientation (GtkWidget *button,
                    GtkWidget *menubar)
{
  GtkWidget *parent;
  GtkWidget *box = NULL;

  parent = gtk_widget_get_parent (menubar);

  if (GTK_IS_VBOX (parent))
    {
      box = gtk_widget_get_parent (parent);

      g_object_ref (menubar);
      gtk_container_remove (GTK_CONTAINER (parent), menubar);
      gtk_container_add (GTK_CONTAINER (box), menubar);
      gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
      g_object_unref (menubar);
      g_object_set (menubar, 
		    "pack-direction", GTK_PACK_DIRECTION_TTB,
		    NULL);
    }
  else
    {
      GList *children, *l;

      children = gtk_container_get_children (GTK_CONTAINER (parent));
      for (l = children; l; l = l->next)
	{
	  if (GTK_IS_VBOX (l->data))
	    {
	      box = l->data;
	      break;
	    }
	}
      g_list_free (children);

      g_object_ref (menubar);
      gtk_container_remove (GTK_CONTAINER (parent), menubar);
      gtk_container_add (GTK_CONTAINER (box), menubar);
      gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
      g_object_unref (menubar);
      g_object_set (menubar, 
		    "pack-direction", GTK_PACK_DIRECTION_LTR,
		    NULL);
    }
}
Esempio n. 7
0
void
asgtk_image_view_add_tool (ASGtkImageView * iv, GtkWidget * tool,
													 int spacing)
{
	g_return_if_fail (ASGTK_IS_IMAGE_VIEW (iv));
	if (tool) {
		if (GTK_IS_VBOX (iv->tools_hbox)) {
			//gtk_widget_set_size_request( tool, iv->details_label->requisition.width, -1 );    
			gtk_box_pack_end (GTK_BOX (iv->tools_hbox), tool, FALSE, FALSE,
												spacing);
		} else
			gtk_box_pack_start (GTK_BOX (iv->tools_hbox), tool, TRUE, TRUE,
													spacing);
		gtk_container_set_border_width (GTK_CONTAINER (iv->tools_hbox), 1);
	}
}
Esempio n. 8
0
static void add_slider(GtkWidget *win) {
	GList *wl, *wl1;
	GtkWidget *vbox = NULL;

	/* Look up this window to see if it already has a slider */
	if (!find_slidwin(win)) {
		GtkWidget *slider_box = NULL;
		slider_win *slidwin = NULL;
		GtkRequisition slidereq;
		gint width, height;

		/* Get top vbox */
		for (wl1 = wl = gtk_container_get_children(
					GTK_CONTAINER(win));
				wl != NULL;
				wl = wl->next) {
			if (GTK_IS_VBOX(GTK_OBJECT(wl->data)))
				vbox = GTK_WIDGET(wl->data);
			else {
				purple_debug_error(WINTRANS_PLUGIN_ID,
					"no vbox found\n");
				return;
			}
		}
		g_list_free(wl1);

		slider_box = wintrans_slider(win);
		/* Figure out how tall the slider wants to be */
		gtk_widget_size_request(slider_box, &slidereq);
		gtk_window_get_size(GTK_WINDOW(win), &width, &height);
		gtk_box_pack_start(GTK_BOX(vbox),
			slider_box, FALSE, FALSE, 0);
#if 0 /*Now that we save window sizes, don't resize it or else it causes windows to grow*/
		/* Make window taller so we don't slowly collapse its message area */
		gtk_window_resize(GTK_WINDOW(win), width,
			(height + slidereq.height));
#endif
		/* Add window to list, to track that it has a slider */
		slidwin = g_new0(slider_win, 1);
		slidwin->win = win;
		slidwin->slider = slider_box;
		window_list = g_slist_append(window_list, slidwin);
	}
}
Esempio n. 9
0
static void
set_logical_font                                (GtkWidget *button)
{
    HeCheckButtonPrivate *priv = HE_CHECK_BUTTON_GET_PRIVATE (button);

    /* In buttons with vertical arrangement, the 'value' label uses a
     * different font */
    if (GTK_IS_VBOX (priv->label_box)) {
        GtkStyle *style = gtk_rc_get_style_by_paths (
            gtk_settings_get_default (), "SmallSystemFont", NULL, G_TYPE_NONE);
        if (style != NULL) {
            PangoFontDescription *font_desc = style->font_desc;
            if (font_desc != NULL) {
                priv->setting_style = TRUE;
                gtk_widget_modify_font (GTK_WIDGET (priv->value), font_desc);
                priv->setting_style = FALSE;
            }
        }
    }
}
Esempio n. 10
0
GtkWidget *
add_separator (GtkWidget * box, gint fill, gint pad)
{
  GtkWidget *sep;

  if (GTK_IS_HBOX (box))
    {
      sep = gtk_vseparator_new ();
      gtk_box_pack_start (GTK_BOX (box), sep, fill, TRUE, pad);
    }
  else if (GTK_IS_VBOX (box))
    {
      sep = gtk_hseparator_new ();
      gtk_box_pack_start (GTK_BOX (box), sep, fill, TRUE, pad);
    }
  else
    {
      return NULL;
    }

  gtk_widget_show (sep);
  return sep;
}
Esempio n. 11
0
static GObject * display_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	Display * self;
	parent_class = G_OBJECT_CLASS (display_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DISPLAY (obj);
	{
		GtkLabel* _label0;
		GtkHBox* _hbox0;
		GtkLabel* _label1;
		GtkLabel* _label2;
		GtkLabel* _label3;
		GtkLabel* _tmp0_;
		GtkComboBox* _tmp1_;
		GtkHBox* _tmp2_;
		GtkLabel* _tmp3_;
		GtkSpinButton* _tmp4_;
		GtkLabel* _tmp5_;
		GtkSpinButton* _tmp6_;
		GtkLabel* _tmp7_;
		GtkSpinButton* _tmp8_;
		GtkVBox* _tmp9_;
		GtkVBox* _tmp10_;
		GtkVBox* _tmp11_;
		GtkVBox* _tmp12_;
		_label0 = NULL;
		_hbox0 = NULL;
		_label1 = NULL;
		_label2 = NULL;
		_label3 = NULL;
		_label0 = (_tmp0_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic ("Display data blocks as images using imagemagick")), _g_object_unref0 (_label0), _tmp0_);
		self->priv->cb = (_tmp1_ = g_object_ref_sink ((GtkComboBox*) gtk_combo_box_new_text ()), _g_object_unref0 (self->priv->cb), _tmp1_);
		_hbox0 = (_tmp2_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 10)), _g_object_unref0 (_hbox0), _tmp2_);
		_label1 = (_tmp3_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic ("Width:")), _g_object_unref0 (_label1), _tmp3_);
		self->priv->width = (_tmp4_ = g_object_ref_sink ((GtkSpinButton*) gtk_spin_button_new_with_range ((double) 50, (double) 5000, (double) 2)), _g_object_unref0 (self->priv->width), _tmp4_);
		_label2 = (_tmp5_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic ("Height:")), _g_object_unref0 (_label2), _tmp5_);
		self->priv->height = (_tmp6_ = g_object_ref_sink ((GtkSpinButton*) gtk_spin_button_new_with_range ((double) 50, (double) 5000, (double) 2)), _g_object_unref0 (self->priv->height), _tmp6_);
		_label3 = (_tmp7_ = g_object_ref_sink ((GtkLabel*) gtk_label_new_with_mnemonic ("Depth:")), _g_object_unref0 (_label3), _tmp7_);
		self->priv->depth = (_tmp8_ = g_object_ref_sink ((GtkSpinButton*) gtk_spin_button_new_with_range ((double) 1, (double) 32, (double) 1)), _g_object_unref0 (self->priv->depth), _tmp8_);
		gtk_window_set_title ((GtkWindow*) self, "Display data blocks");
		gtk_dialog_set_has_separator ((GtkDialog*) self, FALSE);
		gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
		g_object_set ((GtkWindow*) self, "default-width", 300, NULL);
		g_object_set ((GtkWindow*) self, "default-height", 80, NULL);
		g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _display_on_response_gtk_dialog_response, self, 0);
		g_signal_connect ((GtkObject*) self, "destroy", (GCallback) _gtk_main_quit_gtk_object_destroy, NULL);
		gtk_label_set_mnemonic_widget (_label0, (GtkWidget*) self->priv->cb);
		gtk_box_pack_start ((GtkBox*) (_tmp9_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp9_) ? ((GtkVBox*) _tmp9_) : NULL), (GtkWidget*) _label0, FALSE, TRUE, (guint) 0);
		g_signal_connect_object (self->priv->cb, "changed", (GCallback) __lambda0__gtk_combo_box_changed, self, 0);
		gtk_box_pack_start ((GtkBox*) (_tmp10_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp10_) ? ((GtkVBox*) _tmp10_) : NULL), (GtkWidget*) self->priv->cb, FALSE, TRUE, (guint) 0);
		gtk_label_set_mnemonic_widget (_label1, (GtkWidget*) self->priv->width);
		gtk_box_pack_start ((GtkBox*) _hbox0, (GtkWidget*) _label1, FALSE, TRUE, (guint) 0);
		gtk_spin_button_set_value (self->priv->width, (double) 320);
		gtk_container_add ((GtkContainer*) _hbox0, (GtkWidget*) self->priv->width);
		gtk_label_set_mnemonic_widget (_label2, (GtkWidget*) self->priv->height);
		gtk_box_pack_start ((GtkBox*) _hbox0, (GtkWidget*) _label2, FALSE, TRUE, (guint) 0);
		gtk_spin_button_set_value (self->priv->height, (double) 240);
		gtk_container_add ((GtkContainer*) _hbox0, (GtkWidget*) self->priv->height);
		gtk_label_set_mnemonic_widget (_label3, (GtkWidget*) self->priv->depth);
		gtk_box_pack_start ((GtkBox*) _hbox0, (GtkWidget*) _label3, FALSE, TRUE, (guint) 0);
		gtk_spin_button_set_value (self->priv->depth, (double) 8);
		gtk_container_add ((GtkContainer*) _hbox0, (GtkWidget*) self->priv->depth);
		gtk_container_add ((GtkContainer*) (_tmp11_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp11_) ? ((GtkVBox*) _tmp11_) : NULL), (GtkWidget*) _hbox0);
		gtk_box_set_spacing ((GtkBox*) (_tmp12_ = ((GtkDialog*) self)->vbox, GTK_IS_VBOX (_tmp12_) ? ((GtkVBox*) _tmp12_) : NULL), 10);
		_g_object_unref0 (_label0);
		_g_object_unref0 (_hbox0);
		_g_object_unref0 (_label1);
		_g_object_unref0 (_label2);
		_g_object_unref0 (_label3);
	}
	return obj;
}
Esempio n. 12
0
GtkWidget *
about_dialog_create (GimpContext *context)
{
  static GimpAboutDialog *dialog = NULL;

  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);

  if (! dialog)
    {
      GtkWidget *widget;
      GtkWidget *container;
      GdkPixbuf *pixbuf;
      GList     *children;
      gchar     *copyright;

      dialog = g_new0 (GimpAboutDialog, 1);

      dialog->n_authors = G_N_ELEMENTS (authors) - 1;

      pixbuf = about_dialog_load_logo ();

      copyright = g_strdup_printf (GIMP_COPYRIGHT, GIMP_GIT_LAST_COMMIT_YEAR);

      widget = g_object_new (GTK_TYPE_ABOUT_DIALOG,
                             "role",               "gimp-about",
                             "window-position",    GTK_WIN_POS_CENTER,
                             "title",              _("About GIMP"),
                             "program-name",       GIMP_ACRONYM,
                             "version",            GIMP_VERSION,
                             "copyright",          copyright,
                             "comments",           GIMP_NAME,
                             "license",            GIMP_LICENSE,
                             "wrap-license",       TRUE,
                             "logo",               pixbuf,
                             "website",            "http://www.gimp.org/",
                             "website-label",      _("Visit the GIMP website"),
                             "authors",            authors,
                             "artists",            artists,
                             "documenters",        documenters,
                             /* Translators: insert your names here,
                                separated by newline */
                             "translator-credits", _("translator-credits"),
                             NULL);

      if (pixbuf)
        g_object_unref (pixbuf);

      g_free (copyright);

      dialog->dialog = widget;

      g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog);

      g_signal_connect (widget, "response",
                        G_CALLBACK (gtk_widget_destroy),
                        NULL);

      g_signal_connect (widget, "map",
                        G_CALLBACK (about_dialog_map),
                        dialog);
      g_signal_connect (widget, "unmap",
                        G_CALLBACK (about_dialog_unmap),
                        dialog);

      /*  kids, don't try this at home!  */
      container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
      children = gtk_container_get_children (GTK_CONTAINER (container));

      if (GTK_IS_VBOX (children->data))
        {
          about_dialog_add_animation (children->data, dialog);
          about_dialog_add_message (children->data);
        }
      else
        g_warning ("%s: ooops, no vbox in this container?", G_STRLOC);

      g_list_free (children);
    }

  gtk_window_present (GTK_WINDOW (dialog->dialog));

  return dialog->dialog;
}
Esempio n. 13
0
void
gimp_enum_radio_frame_add (GtkFrame  *frame,
                           GtkWidget *widget,
                           gint       enum_value)
{
  GtkWidget *vbox;
  GList     *children;
  GList     *list;
  gint       pos;

  g_return_if_fail (GTK_IS_FRAME (frame));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  vbox = gtk_bin_get_child (GTK_BIN (frame));

  g_return_if_fail (GTK_IS_VBOX (vbox));

  children = gtk_container_get_children (GTK_CONTAINER (vbox));

  for (list = children, pos = 1;
       list;
       list = g_list_next (list), pos++)
    {
      if (GTK_IS_RADIO_BUTTON (list->data) &&
          GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) ==
          enum_value)
        {
          GtkWidget *radio = list->data;
          GtkWidget *hbox;
          GtkWidget *spacer;
          gint       indicator_size;
          gint       indicator_spacing;
          gint       focus_width;
          gint       focus_padding;

          gtk_widget_style_get (radio,
                                "indicator-size",    &indicator_size,
                                "indicator-spacing", &indicator_spacing,
                                "focus-line-width",  &focus_width,
                                "focus-padding",     &focus_padding,
                                NULL);

          hbox = gtk_hbox_new (FALSE, 0);

          spacer = gtk_vbox_new (FALSE, 0);
          gtk_widget_set_size_request (spacer,
                                       indicator_size +
                                       3 * indicator_spacing +
                                       focus_width +
                                       focus_padding +
                                       GTK_CONTAINER (radio)->border_width,
                                       -1);
          gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
          gtk_widget_show (spacer);

          gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
          gtk_widget_show (widget);

          g_object_set_data (G_OBJECT (radio), "set_sensitive", hbox);
          g_signal_connect (radio, "toggled",
                            G_CALLBACK (gimp_toggle_button_sensitive_update),
                            NULL);

          gtk_widget_set_sensitive (hbox,
                                    GTK_TOGGLE_BUTTON (list->data)->active);

          gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
          gtk_box_reorder_child (GTK_BOX (vbox), hbox, pos);
          gtk_widget_show (hbox);

          break;
        }
    }

  g_list_free (children);
}