示例#1
0
static void gtk_service_init(GtkService *service)
{
	GtkServicePrivate *priv;

	priv =  G_TYPE_INSTANCE_GET_PRIVATE(service,
						GTK_TYPE_SERVICE,
						GtkServicePrivate);
	service->priv = priv;

	priv->box = (GtkBox *) gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);

	priv->name = (GtkLabel *) gtk_label_new(NULL);
	priv->state = (GtkImage *) gtk_image_new();
	priv->security = (GtkImage *) gtk_image_new();
	priv->signal = (GtkImage *) gtk_image_new();

	priv->selected = FALSE;

	//gtk_widget_set_halign((GtkWidget *)priv->box, GTK_ALIGN_START);
	gtk_widget_set_halign((GtkWidget *)priv->name, GTK_ALIGN_START);

	gtk_widget_set_halign((GtkWidget *)priv->state, GTK_ALIGN_END);
	gtk_widget_set_halign((GtkWidget *)priv->security, GTK_ALIGN_END);
	gtk_widget_set_halign((GtkWidget *)priv->signal, GTK_ALIGN_END);

	gtk_box_set_homogeneous(priv->box, FALSE);

	gtk_box_pack_start(priv->box,
			(GtkWidget *)priv->name, TRUE, TRUE, 0);

	gtk_box_pack_start(priv->box,
			(GtkWidget *) priv->state, TRUE, TRUE, 0);
	gtk_box_pack_start(priv->box,
			(GtkWidget *) priv->security, TRUE, TRUE, 0);
	gtk_box_pack_start(priv->box,
			(GtkWidget *) priv->signal, TRUE, TRUE, 0);

	gtk_widget_set_visible((GtkWidget *)priv->box, TRUE);
	gtk_widget_set_visible((GtkWidget *)priv->name, TRUE);

	gtk_widget_set_visible((GtkWidget *)priv->state, FALSE);
	gtk_widget_set_visible((GtkWidget *)priv->security, FALSE);
	gtk_widget_set_visible((GtkWidget *)priv->signal, FALSE);

	gtk_container_add(GTK_CONTAINER(service), (GtkWidget *)priv->box);

	gtk_widget_set_can_focus((GtkWidget *)priv->box, TRUE);
}
示例#2
0
文件: gtkutil.c 项目: seandst/hexchat
void
fe_get_str (char *msg, char *def, void *callback, void *userdata)
{
	GtkWidget *dialog;
	GtkWidget *entry;
	GtkWidget *hbox;
	GtkWidget *label;
	extern GtkWidget *parent_window;

	dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
										GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
										GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
										NULL);

	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
	gtk_box_set_homogeneous (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), TRUE);

	if (userdata == (void *)1)	/* nick box is usually on the very bottom, make it centered */
	{
		gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
	}
	else
	{
		gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
	}

	hbox = gtk_hbox_new (TRUE, 0);

	g_object_set_data (G_OBJECT (dialog), "cb", callback);
	g_object_set_data (G_OBJECT (dialog), "ud", userdata);

	entry = gtk_entry_new ();
	g_signal_connect (G_OBJECT (entry), "activate",
						 	G_CALLBACK (gtkutil_str_enter), dialog);
	gtk_entry_set_text (GTK_ENTRY (entry), def);
	gtk_box_pack_end (GTK_BOX (hbox), entry, 0, 0, 0);

	label = gtk_label_new (msg);
	gtk_box_pack_end (GTK_BOX (hbox), label, 0, 0, 0);

	g_signal_connect (G_OBJECT (dialog), "response",
						   G_CALLBACK (gtkutil_get_str_response), entry);

	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox);

	gtk_widget_show_all (dialog);
}
static GtkWidget*
hcp_app_view_create_separator (const gchar *label)
{
  GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
  gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
  GtkWidget *separator_1 = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
  GtkWidget *separator_2 = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
  GtkWidget *label_1 = gtk_label_new (label);

  gtk_widget_set_name (separator_1, "hildon-control-panel-separator");
  gtk_widget_set_name (separator_2, "hildon-control-panel-separator");
  gtk_box_pack_start (GTK_BOX(hbox), separator_1, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX(hbox), label_1, FALSE, FALSE, 5);
  gtk_box_pack_start (GTK_BOX(hbox), separator_2, TRUE, TRUE, 0);

  return hbox;
}
示例#4
0
文件: box.c 项目: aidanholm/luakit
widget_t *
widget_box(lua_State *UNUSED(L), widget_t *w, luakit_token_t token)
{
    w->index = luaH_box_index;
    w->newindex = luaH_box_newindex;

    w->widget = gtk_box_new((token == L_TK_VBOX) ?
            GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_set_homogeneous(GTK_BOX(w->widget), (token == L_TK_VBOX) ? FALSE : TRUE);

    g_object_connect(G_OBJECT(w->widget),
      LUAKIT_WIDGET_SIGNAL_COMMON(w)
      "signal::add",        G_CALLBACK(add_cb),        w,
      NULL);
    gtk_widget_show(w->widget);
    return w;
}
示例#5
0
GtkWidget *
slab_section_new_with_markup (const gchar * title_markup, SlabStyle style)
{
	SlabSection *section;
	GtkWidget *align;
	gchar * widget_theming_name;

	section = g_object_new (SLAB_SECTION_TYPE, NULL);
	gtk_box_set_homogeneous (GTK_BOX (section), FALSE);
	gtk_box_set_spacing (GTK_BOX (section), 0);
	section->style = style;
	section->selected = FALSE;

	align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
	switch (style)
	{
	case Style1:
		gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 0, 0);
		widget_theming_name = "slab_section_style1";
		break;
	case Style2:
		gtk_alignment_set_padding (GTK_ALIGNMENT (align), SLAB_TOP_PADDING,
			SLAB_BOTTOM_PADDING, SLAB_LEFT_PADDING, 0);
		widget_theming_name = "slab_section_style2";
		break;
	default:
		g_assert_not_reached ();
	}
	gtk_box_pack_start (GTK_BOX (section), align, TRUE, TRUE, 0);

	section->childbox = GTK_BOX (gtk_vbox_new (FALSE, 10));
	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (section->childbox));

	section->title = gtk_label_new (title_markup);
	gtk_label_set_use_markup (GTK_LABEL (section->title), TRUE);
	gtk_misc_set_alignment (GTK_MISC (section->title), 0.0, 0.5);

	gtk_widget_set_name (GTK_WIDGET (section), widget_theming_name);
	g_signal_connect (G_OBJECT (section), "style-set", G_CALLBACK (slab_section_style_set),
		NULL);

	gtk_box_pack_start (section->childbox, section->title, FALSE, FALSE, 0);

	return GTK_WIDGET (section);
}
static void add_to_catalog_button_clicked(GtkButton *button, XmiMsimGuiLayerDialog *dialog) {
  GtkWidget *update_dialog;
  GtkWidget *content_area, *vbox;

  update_dialog = gtk_dialog_new_with_buttons("Add current layer to the catalog",
    GTK_WINDOW(dialog),
    (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
    "_Ok", GTK_RESPONSE_ACCEPT, "_Cancel", GTK_RESPONSE_REJECT, NULL);
  gtk_widget_set_size_request(update_dialog, 300,-1);

  content_area = gtk_dialog_get_content_area(GTK_DIALOG(update_dialog));
  vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
  gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
  gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new("Choose a name for the layer"), TRUE, FALSE, 2);
  gtk_container_set_border_width(GTK_CONTAINER(vbox), 15);
  GtkWidget *nameEntry = gtk_entry_new();
  gtk_box_pack_start(GTK_BOX(vbox), nameEntry, TRUE, TRUE, 2);
  GtkWidget *okButton = gtk_dialog_get_widget_for_response(GTK_DIALOG(update_dialog), GTK_RESPONSE_ACCEPT);
  gtk_widget_set_sensitive(okButton, FALSE);
  g_signal_connect(G_OBJECT(nameEntry),"changed",G_CALLBACK(name_entry_changed), (gpointer) okButton);

  gtk_widget_show_all(vbox);
  gtk_container_add (GTK_CONTAINER (content_area), vbox);

  if (gtk_dialog_run(GTK_DIALOG(update_dialog)) == GTK_RESPONSE_ACCEPT) {
    gchar *layer_name = g_strstrip(g_strdup(gtk_entry_get_text(GTK_ENTRY(nameEntry))));
    GtkWidget *error_dialog;
    xmi_layer *layer = xmi_msim_gui_layer_dialog_get_layer(dialog);

    if (xmimsim_gui_add_user_defined_layer(layer, layer_name) == 1) {
      error_dialog = gtk_message_dialog_new(GTK_WINDOW(update_dialog), (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Layer %s has been added to the catalog", layer_name);
    }
    else {
      error_dialog = gtk_message_dialog_new(GTK_WINDOW(update_dialog), (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Could not add layer %s to the catalog.\nReport this incident to the developers.", layer_name);
    }
    gtk_dialog_run(GTK_DIALOG(error_dialog));
    gtk_widget_destroy(error_dialog);
    g_free(layer_name);
    xmi_layer_free(layer);
    g_free(layer);
  }
  gtk_widget_destroy(update_dialog);

  return;
}
static void gtk_technology_init(GtkTechnology *technology)
{
	GtkTechnologyPrivate *priv;

	priv =  G_TYPE_INSTANCE_GET_PRIVATE(technology,
						GTK_TYPE_TECHNOLOGY,
						GtkTechnologyPrivate);
	technology->priv = priv;

	priv->box = (GtkBox *) gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
	priv->enabler = (GtkSwitch *) gtk_switch_new();
	priv->name = (GtkLabel *) gtk_label_new(NULL);


	gtk_widget_set_margin_left((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_right((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_top((GtkWidget *)priv->enabler, 0);
	gtk_widget_set_margin_bottom((GtkWidget *)priv->enabler, 0);

	gtk_widget_set_margin_left((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_right((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_top((GtkWidget *)priv->name, 0);
	gtk_widget_set_margin_bottom((GtkWidget *)priv->name, 0);

	gtk_box_set_spacing(priv->box, 0);
	gtk_box_set_homogeneous(priv->box, TRUE);

	//gtk_widget_set_halign((GtkWidget *)priv->box, GTK_ALIGN_START);
	gtk_widget_set_halign((GtkWidget *)priv->name, GTK_ALIGN_START);
	//gtk_widget_set_halign((GtkWidget *)technology, GTK_ALIGN_START);

	gtk_box_pack_start(priv->box,
			(GtkWidget *)priv->enabler, FALSE, FALSE, 0);
	gtk_box_pack_start(priv->box,
			(GtkWidget *)priv->name, FALSE, FALSE, 0);

	gtk_widget_set_visible((GtkWidget *)priv->box, TRUE);
	gtk_widget_set_visible((GtkWidget *)priv->enabler, TRUE);
	gtk_widget_set_visible((GtkWidget *)priv->name, TRUE);

	gtk_container_add(GTK_CONTAINER(technology), (GtkWidget *)priv->box);

	gtk_widget_set_can_focus((GtkWidget *)priv->box, TRUE);
	gtk_widget_set_can_focus((GtkWidget *)priv->enabler, TRUE);
}
示例#8
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_vbox_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean homogeneous;
  gint spacing, size;

  size = gb_widget_input_int (data, Size);
  if (data->apply)
    gb_box_set_size (widget, size);

  homogeneous = gb_widget_input_bool (data, Homogeneous);
  if (data->apply)
    gtk_box_set_homogeneous (GTK_BOX (widget), homogeneous);

  spacing = gb_widget_input_int (data, Spacing);
  if (data->apply)
    gtk_box_set_spacing (GTK_BOX (widget), spacing);
}
/* nautilus_keep_last_vertical_box_new:
 *
 * Create a new vertical box that clips off items from the end that don't
 * fit, except the last item, which is always kept. When packing this widget
 * into another vbox, use TRUE for expand and TRUE for fill or this class's
 * special clipping magic won't work because this widget's allocation might
 * be larger than the available space.
 *
 * @spacing: Vertical space between items.
 *
 * Return value: A new NautilusKeepLastVerticalBox
 */
GtkWidget *
nautilus_keep_last_vertical_box_new (gint spacing)
{
    NautilusKeepLastVerticalBox *box;

    box = NAUTILUS_KEEP_LAST_VERTICAL_BOX (gtk_widget_new (nautilus_keep_last_vertical_box_get_type (), NULL));

    gtk_box_set_spacing (GTK_BOX (box), spacing);

    /* If homogeneous is TRUE and there are too many items to fit
     * naturally, they will be squashed together to fit in the space.
     * We want the ones that don't fit to be not shown at all, so
     * we set homogeneous to FALSE.
     */
    gtk_box_set_homogeneous (GTK_BOX (box), FALSE);

    return GTK_WIDGET (box);
}
示例#10
0
static void
math_variable_popup_init(MathVariablePopup *popup)
{
    popup->priv = G_TYPE_INSTANCE_GET_PRIVATE(popup, math_variable_popup_get_type(), MathVariablePopupPrivate);

    gtk_window_set_decorated(GTK_WINDOW(popup), FALSE);
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(popup), TRUE);

    gtk_container_set_border_width(GTK_CONTAINER(popup), 6);

    /* Destroy this window when it loses focus */
    g_signal_connect(G_OBJECT(popup), "focus-out-event", G_CALLBACK(variable_focus_out_event_cb), popup);

    popup->priv->vbox = gtk_vbox_new(FALSE, 6);
    gtk_box_set_homogeneous(GTK_BOX(popup->priv->vbox), TRUE);
    gtk_container_add(GTK_CONTAINER(popup), popup->priv->vbox);
    gtk_widget_show(popup->priv->vbox);
}
void
go_combo_box_construct (GOComboBox *combo,
			GtkWidget *display_widget,
			GtkWidget *popdown_container,
			G_GNUC_UNUSED GtkWidget *popdown_focus)
{
	GtkWidget *tearable;
	GtkWidget *vbox;

	g_return_if_fail (GO_IS_COMBO_BOX (combo));

	gtk_box_set_spacing (GTK_BOX (combo), 0);
	gtk_box_set_homogeneous (GTK_BOX (combo), FALSE);

	combo->priv->popdown_container = popdown_container;
	combo->priv->display_widget = NULL;

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
	tearable = gtk_tearoff_menu_item_new ();
	g_signal_connect (tearable, "enter-notify-event",
			  G_CALLBACK (cb_tearable_enter_leave),
			  GINT_TO_POINTER (TRUE));
	g_signal_connect (tearable, "leave-notify-event",
			  G_CALLBACK (cb_tearable_enter_leave),
			  GINT_TO_POINTER (FALSE));
	g_signal_connect (tearable, "button-release-event",
			  G_CALLBACK (cb_tearable_button_release),
			  (gpointer) combo);
	g_signal_connect (tearable, "parent-set",
			  G_CALLBACK (cb_tearable_parent_changed),
			  (gpointer) combo);
	gtk_box_pack_start (GTK_BOX (vbox), tearable, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox), popdown_container, TRUE, TRUE, 0);
	combo->priv->tearable = tearable;
	g_object_set (tearable, "no-show-all", TRUE, NULL);

	go_combo_box_set_tearable (combo, FALSE);

	go_combo_box_set_relief (combo, GTK_RELIEF_NORMAL);

	go_combo_box_set_display (combo, display_widget);
	gtk_container_add (GTK_CONTAINER (combo->priv->frame), vbox);
	gtk_widget_show_all (combo->priv->frame);
}
示例#12
0
static GObject*
lyric_show_viewport_constructor(GType                  type,
                guint                  n_construct_properties,
                GObjectConstructParam *construct_properties)
{
    GObject *object;
    LyricShowViewport *lsv;
    GtkWidget *hbox;
    object = G_OBJECT_CLASS(lyric_show_viewport_parent_class)->constructor(
                                    type,
                                    n_construct_properties,
                                    construct_properties);
    lsv = LYRIC_SHOW_VIEWPORT(object);
    lsv->priv->msg = gtk_label_new("");

    lsv->priv->lyricbox = 
#if GTK_CHECK_VERSION(3,2,0)
    gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
    gtk_box_set_homogeneous(GTK_BOX(lsv->priv->lyricbox),TRUE);
#else
    gtk_vbox_new(TRUE,2);
#endif

    hbox =
#if GTK_CHECK_VERSION(3,2,0)
    gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
#else
    gtk_hbox_new(FALSE,0);
#endif
    lsv->priv->box_bin = gtk_bin_instance_new();

    gtk_box_pack_start(GTK_BOX(hbox),lsv->priv->msg,TRUE,TRUE,0);
    gtk_box_pack_start(GTK_BOX(hbox),lsv->priv->lyricbox,TRUE,TRUE,0);
    gtk_widget_set_no_show_all(lsv->priv->lyricbox,TRUE);
    gtk_widget_set_no_show_all(lsv->priv->msg,TRUE);
    gtk_container_add(GTK_CONTAINER(lsv->priv->box_bin),hbox);
    gtk_widget_show_all(hbox);
    gtk_widget_show_all(lsv->priv->box_bin);
    gtk_container_add(GTK_CONTAINER(lsv),lsv->priv->box_bin);

    gtk_viewport_set_shadow_type(GTK_VIEWPORT(lsv),GTK_SHADOW_IN);
    return object;
}
示例#13
0
static void
xfce_mixer_option_create_contents (XfceMixerOption *option)
{
  GstMixerOptions *options;
  GtkWidget       *label;
  const GList     *iter;
  const gchar     *active_option;
  gchar           *track_label;
  gchar           *title;
  gint             i;

  gtk_box_set_homogeneous (GTK_BOX (option), FALSE);
  gtk_box_set_spacing (GTK_BOX (option), 12);

  g_object_get (option->track, "label", &track_label, NULL);
  title = g_strdup_printf ("%s:", track_label);
  g_free (track_label);

  label = gtk_label_new (title);
  gtk_box_pack_start (GTK_BOX (option), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  options = GST_MIXER_OPTIONS (option->track);
  active_option = gst_mixer_get_option (GST_MIXER (option->card), options);

  option->combo = gtk_combo_box_new_text ();

  for (iter = options->values, i = 0; iter != NULL; iter = g_list_next (iter), ++i)
    {
      gtk_combo_box_append_text (GTK_COMBO_BOX (option->combo), iter->data);

      if (G_UNLIKELY (g_utf8_collate (active_option, iter->data) == 0))
        gtk_combo_box_set_active (GTK_COMBO_BOX (option->combo), i);
    }
  
  gtk_box_pack_start (GTK_BOX (option), option->combo, FALSE, FALSE, 0);
  gtk_widget_show (option->combo);

  g_signal_connect (option->combo, "changed", G_CALLBACK (xfce_mixer_option_changed), option);

  g_free (title);
}
示例#14
0
void
fe_get_int (char *msg, int def, void *callback, void *userdata)
{
	GtkWidget *dialog;
	GtkWidget *spin;
	GtkWidget *hbox;
	GtkWidget *label;
	GtkAdjustment *adj;
	extern GtkWidget *parent_window;

	dialog = gtk_dialog_new_with_buttons (msg, NULL, 0,
										GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
										GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
										NULL);
	gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->vbox), TRUE);
	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));

	hbox = gtk_hbox_new (TRUE, 0);

	g_object_set_data (G_OBJECT (dialog), "cb", callback);
	g_object_set_data (G_OBJECT (dialog), "ud", userdata);

	spin = gtk_spin_button_new (NULL, 1, 0);
	adj = gtk_spin_button_get_adjustment ((GtkSpinButton*)spin);
	adj->lower = 0;
	adj->upper = 1024;
	adj->step_increment = 1;
	gtk_adjustment_changed (adj);
	gtk_spin_button_set_value ((GtkSpinButton*)spin, def);
	gtk_box_pack_end (GTK_BOX (hbox), spin, 0, 0, 0);

	label = gtk_label_new (msg);
	gtk_box_pack_end (GTK_BOX (hbox), label, 0, 0, 0);

	g_signal_connect (G_OBJECT (dialog), "response",
						   G_CALLBACK (gtkutil_get_number_response), spin);

	gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);

	gtk_widget_show_all (dialog);
}
示例#15
0
GtkWidget *
gnc_split_reg2_create_summary_bar (GNCSplitReg2 *gsr)
{
    GtkWidget *summarybar;

    gsr->cleared_label    = NULL;
    gsr->balance_label    = NULL;
    gsr->reconciled_label = NULL;
    gsr->future_label     = NULL;
    gsr->projectedminimum_label = NULL;
    gsr->shares_label     = NULL;
    gsr->value_label      = NULL;

    if (gnc_ledger_display2_type (gsr->ledger) >= LD2_SUBACCOUNT)
    {
        gsr->summarybar = NULL;
        return NULL;
    }

    summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
    gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);

    if (!xaccAccountIsPriced(gnc_ledger_display2_leader(gsr->ledger)))
    {
        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
    }
    else
    {
        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
    }

    gsr->summarybar = summarybar;

    /* Force the first update */
    gsr2_redraw_all_cb (NULL, gsr);
    return gsr->summarybar;
}
示例#16
0
void ygtk_menu_button_set_label (YGtkMenuButton *button, const gchar *label)
{
	if (!button->label) {
		GtkWidget *hbox, *arrow;
		hbox = YGTK_HBOX_NEW(4);
		gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
		arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
		button->label = gtk_label_new ("");
		gtk_box_pack_start (GTK_BOX (hbox), button->label, TRUE, TRUE, 0);
		gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, TRUE, 0);
		gtk_container_add (GTK_CONTAINER (button), hbox);
		gtk_widget_show_all (hbox);
	}
	if (label && *label) {
		gtk_widget_show (button->label);
		gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label), label);
	}
	else
		gtk_widget_hide (button->label);
}
static void
sunone_invitation_list_init (SunOneInvitationList *object)
{
	SunOneInvitationList *list = SUNONE_INVITATION_LIST (object);
	SunOneInvitationListPrivate *priv;
	GtkWidget *scroll;
	int pos;
	
	list->priv = g_new0 (SunOneInvitationListPrivate, 1);
	priv = list->priv;

	priv->client = gconf_client_get_default ();
	priv->model = NULL;
	priv->treeview = NULL;
	priv->pane = gtk_vpaned_new ();

	gtk_box_set_homogeneous (GTK_BOX (list), FALSE);
	
	scroll = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), 
					GTK_POLICY_AUTOMATIC, 
					GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), 
					GTK_SHADOW_IN);
#if USE_ITIP_VIEW
	priv->control = sunone_itip_view_new ();
#else
	priv->control = bonobo_widget_new_control (INVITATION_CONTROL_IID, NULL);
#endif
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll),
						priv->control);
	
	gtk_paned_add2 (GTK_PANED (priv->pane), GTK_WIDGET (scroll));

	pos = gconf_client_get_int (priv->client,
			"/apps/evolution/evolution-jescs/invitationList/panePosition",
			NULL);
	gtk_paned_set_position (GTK_PANED (priv->pane), pos);

	gtk_box_pack_start (GTK_BOX (list), priv->pane, TRUE, TRUE, 0);
}
示例#18
0
static void accessx_status_applet_reorient(GtkWidget* widget, MatePanelAppletOrient o, gpointer user_data)
{
	AccessxStatusApplet* sapplet = user_data;
	GtkWidget* box;
	GtkWidget* stickyfoo;

	sapplet->orient = o;

	if (o == MATE_PANEL_APPLET_ORIENT_LEFT || o == MATE_PANEL_APPLET_ORIENT_RIGHT)
	{
		box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
		stickyfoo = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	}
	else
	{
		box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
		stickyfoo = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	}
	gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE);
	accessx_status_applet_layout_box(sapplet, box, stickyfoo);
}
示例#19
0
static void
construct_buttons (GisAssistant *assistant,
                   Buttons      *buttons)
{
  buttons->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  gtk_box_set_homogeneous (GTK_BOX (buttons->action_area), TRUE);
  gtk_widget_set_halign (buttons->action_area, GTK_ALIGN_END);

  buttons->forward = gtk_button_new ();
  gtk_button_set_use_underline (GTK_BUTTON (buttons->forward), TRUE);
  gtk_widget_set_can_default (buttons->forward, TRUE);

  buttons->back = gtk_button_new ();
  gtk_button_set_use_underline (GTK_BUTTON (buttons->back), TRUE);

  gtk_box_pack_start (GTK_BOX (buttons->action_area), buttons->back, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (buttons->action_area), buttons->forward, FALSE, FALSE, 0);

  g_signal_connect (buttons->forward, "clicked", G_CALLBACK (go_forward), assistant);
  g_signal_connect (buttons->back, "clicked", G_CALLBACK (go_backward), assistant);
}
示例#20
0
文件: box.c 项目: jerojasro/luakit
static gint
luaH_box_newindex(lua_State *L, luakit_token_t token)
{
    widget_t *w = luaH_checkwidget(L, 1);

    switch(token)
    {
      case L_TK_HOMOGENEOUS:
        gtk_box_set_homogeneous(GTK_BOX(w->widget), luaH_checkboolean(L, 3));
        break;

      case L_TK_SPACING:
        gtk_box_set_spacing(GTK_BOX(w->widget), luaL_checknumber(L, 3));
        break;

      default:
        return 0;
    }

    return luaH_object_emit_property_signal(L, 1);
}
示例#21
0
static
GtkWidget*
add_summary_label (GtkWidget *summarybar, const char *label_str)
{
    GtkWidget *hbox;
    GtkWidget *label;

    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
    gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
    gtk_box_pack_start (GTK_BOX (summarybar), hbox, FALSE, FALSE, 5);

    label = gtk_label_new (label_str);
    gnc_label_set_alignment (label, 1.0, 0.5);
    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

    label = gtk_label_new ("");
    gnc_label_set_alignment (label, 1.0, 0.5);
    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

    return label;
}
示例#22
0
static void
gimp_file_entry_init (GimpFileEntry *entry)
{
    GtkWidget *image;

    entry->title       = NULL;
    entry->file_dialog = NULL;
    entry->check_valid = FALSE;
    entry->file_exists = NULL;

    gtk_orientable_set_orientation (GTK_ORIENTABLE (entry),
                                    GTK_ORIENTATION_HORIZONTAL);

    gtk_box_set_spacing (GTK_BOX (entry), 4);
    gtk_box_set_homogeneous (GTK_BOX (entry), FALSE);

    entry->browse_button = gtk_button_new ();
    gtk_box_pack_end (GTK_BOX (entry), entry->browse_button, FALSE, FALSE, 0);
    gtk_widget_show (entry->browse_button);

    image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
    gtk_container_add (GTK_CONTAINER (entry->browse_button), image);
    gtk_widget_show (image);

    g_signal_connect (entry->browse_button, "clicked",
                      G_CALLBACK (gimp_file_entry_browse_clicked),
                      entry);

    entry->entry = gtk_entry_new ();
    gtk_box_pack_end (GTK_BOX (entry), entry->entry, TRUE, TRUE, 0);
    gtk_widget_show (entry->entry);

    g_signal_connect (entry->entry, "activate",
                      G_CALLBACK (gimp_file_entry_entry_activate),
                      entry);
    g_signal_connect (entry->entry, "focus-out-event",
                      G_CALLBACK (gimp_file_entry_entry_focus_out),
                      entry);
}
示例#23
0
文件: ev-sidebar.c 项目: GNOME/evince
static void
ev_sidebar_init (EvSidebar *ev_sidebar)
{
	EvSidebarPrivate *priv;
	GtkWidget *switcher;
	GtkWidget *stack;

	priv = GET_PRIVATE (ev_sidebar);

	/* data model */
	priv->page_model = (GtkTreeModel *)
			gtk_list_store_new (PAGE_COLUMN_NUM_COLS,
					    G_TYPE_STRING,
					    GTK_TYPE_WIDGET,
					    G_TYPE_STRING,
					    G_TYPE_STRING);

	switcher = gtk_stack_switcher_new ();
	priv->switcher = switcher;
	gtk_box_pack_end (GTK_BOX (ev_sidebar), switcher, FALSE, TRUE, 0);
	g_object_set (switcher, "icon-size", 1, NULL);
	gtk_container_set_border_width (GTK_CONTAINER (switcher), 6);
	gtk_widget_set_halign (switcher, GTK_ALIGN_FILL);
	gtk_widget_set_hexpand (switcher, TRUE);
	gtk_box_set_homogeneous (GTK_BOX (switcher), TRUE);
	gtk_widget_show (priv->switcher);

	stack = gtk_stack_new ();
	priv->stack = stack;
	gtk_stack_set_homogeneous (GTK_STACK (stack), TRUE);
	gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher),
				      GTK_STACK (stack));
	gtk_box_pack_end (GTK_BOX (ev_sidebar), stack, TRUE, TRUE, 0);
	gtk_widget_show (priv->stack);

	g_signal_connect (stack, "notify::visible-child",
			  G_CALLBACK (ev_sidebar_child_change_cb),
			  ev_sidebar);
}
示例#24
0
static GtkWidget *
_build_verification_code_entry_widget (GtkWidget *dialog)
{
  GtkWidget *hbox = NULL;
  GtkWidget *entry = NULL;
  GtkWidget *separator = NULL;
  gchar *entry_key = NULL;
  gint i = 0;

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
  for (i = 0; i < 3; i++)
    {
      entry = gtk_entry_new ();
      gtk_entry_set_max_length (GTK_ENTRY (entry), 3);
      gtk_entry_set_width_chars (GTK_ENTRY (entry), 3);
      gtk_entry_set_alignment (GTK_ENTRY (entry), 0.5);
      gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, FALSE, 6);
      gtk_widget_show (entry);

      entry_key = g_strdup_printf ("vercode-%d", i + 1);
      g_object_set_data (G_OBJECT (dialog), entry_key, entry);
      g_free (entry_key);

      g_signal_connect (G_OBJECT (entry), "insert-text",
                    G_CALLBACK (_code_entry_text_inserted_cb),
                    NULL);
      if (i < 2)
        {
          separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
          gtk_box_pack_start (GTK_BOX (hbox), separator, TRUE, TRUE, 0);
          gtk_widget_show (separator);
        }
    }

  gtk_widget_show (hbox);
  return hbox;
}
示例#25
0
void
uzbl_status_bar_init (UzblStatusBar *status_bar)
{
    static const gint LABEL_MARGIN = 2;

    gtk_box_set_homogeneous (GTK_BOX (status_bar), FALSE);
    gtk_box_set_spacing (GTK_BOX (status_bar), 0);

    /* Create left panel. */
    status_bar->left_label = gtk_label_new ("");
    gtk_label_set_selectable (GTK_LABEL (status_bar->left_label), TRUE);
#if GTK_CHECK_VERSION (3, 10, 0)
    gtk_widget_set_halign (status_bar->left_label, GTK_ALIGN_START);
#else
    gtk_misc_set_alignment (GTK_MISC (status_bar->left_label), 0, 0);
#endif
    g_object_set (G_OBJECT (status_bar->left_label),
        "margin", LABEL_MARGIN,
        NULL);
    gtk_label_set_ellipsize (GTK_LABEL (status_bar->left_label), PANGO_ELLIPSIZE_END);

    /* Create right panel. */
    status_bar->right_label = gtk_label_new ("");
    gtk_label_set_selectable (GTK_LABEL (status_bar->right_label), TRUE);
#if GTK_CHECK_VERSION (3, 10, 0)
    gtk_widget_set_halign (status_bar->right_label, GTK_ALIGN_END);
#else
    gtk_misc_set_alignment (GTK_MISC (status_bar->right_label), 1, 0);
#endif
    g_object_set (G_OBJECT (status_bar->right_label),
        "margin", LABEL_MARGIN,
        NULL);
    gtk_label_set_ellipsize (GTK_LABEL (status_bar->right_label), PANGO_ELLIPSIZE_START);

    /* Add the labels to the status bar. */
    gtk_box_pack_start (GTK_BOX (status_bar), status_bar->left_label,  FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (status_bar), status_bar->right_label, TRUE,  TRUE,  0);
}
示例#26
0
static void accessx_status_applet_reorient(GtkWidget* widget, MatePanelAppletOrient o, gpointer user_data)
{
    AccessxStatusApplet* sapplet = user_data;
    GtkWidget* box;
    GtkWidget* stickyfoo;

    sapplet->orient = o;

    if (o == MATE_PANEL_APPLET_ORIENT_LEFT || o == MATE_PANEL_APPLET_ORIENT_RIGHT)
    {
        box = gtk_vbox_new(FALSE, 0);
        stickyfoo = gtk_vbox_new(TRUE, 0);
    }
    else
    {
        box = gtk_hbox_new(FALSE, 0);
        stickyfoo = gtk_hbox_new(TRUE, 0);
    }
#if GTK_CHECK_VERSION (3, 0, 0)
    gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE);
#endif
    accessx_status_applet_layout_box(sapplet, box, stickyfoo);
}
示例#27
0
文件: box.c 项目: aidanholm/luakit
static gint
luaH_box_newindex(lua_State *L, widget_t *w, luakit_token_t token)
{
    size_t len;
    const gchar *tmp;
    GdkRGBA c;

    switch(token) {
      LUAKIT_WIDGET_NEWINDEX_COMMON(w)

      case L_TK_HOMOGENEOUS:
        gtk_box_set_homogeneous(GTK_BOX(w->widget), luaH_checkboolean(L, 3));
        break;

      case L_TK_SPACING:
        gtk_box_set_spacing(GTK_BOX(w->widget), luaL_checknumber(L, 3));
        break;

      case L_TK_BG:
        tmp = luaL_checklstring(L, 3, &len);
        if (!gdk_rgba_parse(&c, tmp))
            luaL_argerror(L, 3, "unable to parse colour");
#if GTK_CHECK_VERSION(3,16,0)
        widget_set_css_properties(w, "background-color", tmp, NULL);
#else
        gtk_widget_override_background_color(GTK_WIDGET(w->widget), GTK_STATE_FLAG_NORMAL, &c);
#endif
        g_object_set_data_full(G_OBJECT(w->widget), "bg", g_strdup(tmp), g_free);
        break;

      default:
        return 0;
    }

    return luaH_object_property_signal(L, 1, token);
}
LightdmUserList *
lightdm_user_list_new(Xfce4Greeter *xfce4_greeter)
{
	LightdmUserList *user_list;
	GtkWidget *hbox;

	user_list = g_slice_new0(LightdmUserList);

	#if GTK_CHECK_VERSION (3, 0, 0)
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
	#else
	hbox = gtk_hbox_new (TRUE, 0);
	#endif

	user_list->hbox = hbox;
	user_list->xfce4_greeter = xfce4_greeter;

	lightdm_user_list_init(user_list);

	gtk_widget_show(hbox);

	return user_list;
}
示例#29
0
文件: macros.c 项目: Jeija/gtkterm
void Config_macros(GtkAction *action, gpointer data)
{
	GtkWidget *vbox, *hbox;
	GtkWidget *sw;
	GtkTreeModel *model;
	GtkWidget *treeview;
	GtkWidget *button;
	GtkWidget *separator;

	/* create window, etc */
	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (window), _("Configure Macros"));

	g_signal_connect (window, "destroy",
	                  G_CALLBACK (gtk_widget_destroyed), &window);
	gtk_container_set_border_width (GTK_CONTAINER (window), 8);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	gtk_container_add (GTK_CONTAINER (window), vbox);

	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
	                                     GTK_SHADOW_ETCHED_IN);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
	                                GTK_POLICY_NEVER,
	                                GTK_POLICY_AUTOMATIC);
	gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);

	/* create tree model */
	model = create_model ();

	/* create tree view */
	treeview = gtk_tree_view_new_with_model (model);
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
	gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
	                                 COLUMN_SHORTCUT);

	g_object_unref (model);

	gtk_container_add (GTK_CONTAINER (sw), treeview);

	/* add columns to the tree view */
	add_columns (GTK_TREE_VIEW (treeview));

	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

	button = gtk_button_new_with_mnemonic (_("_Add"));
	g_signal_connect(button, "clicked", G_CALLBACK(Add_shortcut), (gpointer)model);
	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	button = gtk_button_new_with_mnemonic (_("_Delete"));
	g_signal_connect(button, "clicked", G_CALLBACK(Delete_shortcut), (gpointer)treeview);
	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	button = gtk_button_new_with_mnemonic (_("_Capture Shortcut"));
	g_signal_connect(button, "clicked", G_CALLBACK(Capture_shortcut), (gpointer)treeview);
	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	separator = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
	gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);

	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

	button = gtk_button_new_from_stock (GTK_STOCK_HELP);
	g_signal_connect(button, "clicked", G_CALLBACK(Help_screen), (gpointer)window);
	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	button = gtk_button_new_from_stock (GTK_STOCK_OK);
	g_signal_connect(button, "clicked", G_CALLBACK(Save_shortcuts), (gpointer)treeview);
	g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
	gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
	g_signal_connect_swapped(button, "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
	gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 0);

	gtk_window_set_default_size (GTK_WINDOW(window), 300, 400);

	gtk_widget_show_all(window);
}
示例#30
0
文件: editable_cells.c 项目: BYC/gtk
GtkWidget *
do_editable_cells (GtkWidget *do_widget)
{
  if (!window)
    {
      GtkWidget *vbox;
      GtkWidget *hbox;
      GtkWidget *sw;
      GtkWidget *treeview;
      GtkWidget *button;
      GtkTreeModel *items_model;
      GtkTreeModel *numbers_model;

      /* create window, etc */
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_screen (GTK_WINDOW (window),
                             gtk_widget_get_screen (do_widget));
      gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
      gtk_container_set_border_width (GTK_CONTAINER (window), 5);
      g_signal_connect (window, "destroy",
                        G_CALLBACK (gtk_widget_destroyed), &window);

      vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
      gtk_container_add (GTK_CONTAINER (window), vbox);

      gtk_box_pack_start (GTK_BOX (vbox),
                          gtk_label_new ("Shopping list (you can edit the cells!)"),
                          FALSE, FALSE, 0);

      sw = gtk_scrolled_window_new (NULL, NULL);
      gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
                                           GTK_SHADOW_ETCHED_IN);
      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                      GTK_POLICY_AUTOMATIC,
                                      GTK_POLICY_AUTOMATIC);
      gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);

      /* create models */
      items_model = create_items_model ();
      numbers_model = create_numbers_model ();

      /* create tree view */
      treeview = gtk_tree_view_new_with_model (items_model);
      gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
      gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
                                   GTK_SELECTION_SINGLE);

      add_columns (GTK_TREE_VIEW (treeview), items_model, numbers_model);

      g_object_unref (numbers_model);
      g_object_unref (items_model);

      gtk_container_add (GTK_CONTAINER (sw), treeview);

      /* some buttons */
      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
      gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

      button = gtk_button_new_with_label ("Add item");
      g_signal_connect (button, "clicked",
                        G_CALLBACK (add_item), items_model);
      gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

      button = gtk_button_new_with_label ("Remove item");
      g_signal_connect (button, "clicked",
                        G_CALLBACK (remove_item), treeview);
      gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

      gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
    }

  if (!gtk_widget_get_visible (window))
    gtk_widget_show_all (window);
  else
    {
      gtk_widget_destroy (window);
      window = NULL;
    }

  return window;
}