Ejemplo n.º 1
0
static void mimeview_show_mime_part(MimeView *mimeview, MimeInfo *partinfo)
{
	TextView *textview = mimeview->textview;
	GtkTextBuffer *buffer;
	GtkTextIter iter;
	GtkTextChildAnchor *anchor;
	GtkWidget *vbbox;
	GtkWidget *button;
	gchar buf[BUFFSIZE];

	if (!partinfo) return;

	textview_set_font(textview, NULL);
	textview_clear(textview);

	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
	gtk_text_buffer_get_start_iter(buffer, &iter);

	gtk_text_buffer_insert(buffer, &iter,
			       _("Select an action for the attached file:\n"),
			       -1);
	if (partinfo->filename || partinfo->name)
		g_snprintf(buf, sizeof(buf), "[%s  %s (%s)]\n\n",
			   partinfo->filename ? partinfo->filename :
			   partinfo->name,
			   partinfo->content_type,
			   to_human_readable(partinfo->content_size));
	else
		g_snprintf(buf, sizeof(buf), "[%s (%s)]\n\n",
			   partinfo->content_type,
			   to_human_readable(partinfo->content_size));
	gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, buf, -1,
						 "mimepart", NULL);

	vbbox = gtk_vbutton_box_new();
	gtk_box_set_spacing(GTK_BOX(vbbox), 5);

	button = gtk_button_new_from_stock(GTK_STOCK_OPEN);
	gtk_container_add(GTK_CONTAINER(vbbox), button);
	g_signal_connect(button, "clicked", G_CALLBACK(open_button_clicked),
			 mimeview);
	button = gtk_button_new_with_mnemonic(_("Open _with..."));
	gtk_container_add(GTK_CONTAINER(vbbox), button);
	g_signal_connect(button, "clicked",
			 G_CALLBACK(open_with_button_clicked), mimeview);
	button = gtk_button_new_with_mnemonic(_("_Display as text"));
	gtk_container_add(GTK_CONTAINER(vbbox), button);
	g_signal_connect(button, "clicked",
			 G_CALLBACK(display_as_text_button_clicked), mimeview);
	button = gtk_button_new_with_mnemonic(_("_Save as..."));
	gtk_container_add(GTK_CONTAINER(vbbox), button);
	g_signal_connect(button, "clicked", G_CALLBACK(save_as_button_clicked),
			 mimeview);

	gtk_widget_show_all(vbbox);

	anchor = gtk_text_buffer_create_child_anchor(buffer, &iter);
	gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(textview->text),
					  vbbox, anchor);
}
Ejemplo n.º 2
0
static void
on_vbbox_dialog_ok (GtkWidget * widget, GbWidgetNewData * data)
{
  GtkWidget *new_widget, *spinbutton, *window, *new_child;
  gint rows, i;

  window = gtk_widget_get_toplevel (widget);

  /* Only call callback if placeholder/fixed widget is still there */
  if (gb_widget_can_finish_new (data))
    {
      spinbutton = gtk_object_get_data (GTK_OBJECT (window), "rows");
      g_return_if_fail (spinbutton != NULL);
      rows = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinbutton));

      new_widget = gtk_vbutton_box_new ();
      for (i = 0; i < rows; i++)
	{
	  new_child = gb_widget_new ("GtkButton", new_widget);
	  GTK_WIDGET_SET_FLAGS (new_child, GTK_CAN_DEFAULT);
	  gtk_container_add (GTK_CONTAINER (new_widget), new_child);
	}
      gb_widget_initialize (new_widget, data);
      (*data->callback) (new_widget, data);
    }
  gtk_widget_destroy (window);
}
Ejemplo n.º 3
0
//
// Constructor
//
CNewFilesBox::CNewFilesBox(void):CInfoBox("Process new frames"), m_Thread(NULL), 
	m_StopThread(false), m_SuspendRq(false), m_Delay(false), m_OutFiles(0), 
	m_ExitCode(0), m_State(STATE_STOP), m_Proc(NULL)
{
	GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 4);
	gtk_box_pack_start(GTK_BOX(m_Box), hbox, FALSE, TRUE, 0);

	// Two text lines
	GtkWidget *vbox = gtk_vbox_new(TRUE, 8);
	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
	m_Line1 = gtk_label_new(NULL);
	gtk_misc_set_alignment(GTK_MISC(m_Line1), 0, 0.5);
	gtk_box_pack_start(GTK_BOX(vbox), m_Line1, TRUE, TRUE, 0);
	m_Line2 = gtk_label_new(NULL);
	gtk_misc_set_alignment(GTK_MISC(m_Line2), 0, 0.5);
	gtk_box_pack_start(GTK_BOX(vbox), m_Line2, TRUE, TRUE, 0);

	// Button box
	GtkWidget *bbox = gtk_vbutton_box_new();
	gtk_box_pack_start(GTK_BOX(hbox), bbox, FALSE, TRUE, 0);
	m_CancelBtn = gtk_button_new_with_label("Cancel");
	gtk_box_pack_start(GTK_BOX(bbox), m_CancelBtn, FALSE, TRUE, 0);
	g_signal_connect(m_CancelBtn, "clicked", G_CALLBACK(cancel_clicked), this);
	m_PauseBtn = gtk_button_new_with_label("Pause");
	gtk_box_pack_start(GTK_BOX(bbox), m_PauseBtn, FALSE, TRUE, 0);
	g_signal_connect(m_PauseBtn, "clicked", G_CALLBACK(pause_clicked), this);

	m_Con = new CNFConsole(this);
	m_Queue = g_async_queue_new();
	m_DataMutex = g_mutex_new();
	m_Cond = g_cond_new();
}
Ejemplo n.º 4
0
GtkWidget *
gtk_button_box_new (GtkOrientation  orientation)
{
  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    return gtk_hbutton_box_new ();
  else
    return gtk_vbutton_box_new ();
}
Ejemplo n.º 5
0
/*
 * Creates a new GtkWidget of class GtkVButtonBox, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
GtkWidget *
gb_vbutton_box_new (GbWidgetNewData * data)
{
  GtkWidget *new_widget;

  if (data->action == GB_LOADING)
    {
      new_widget = gtk_vbutton_box_new ();
      return new_widget;
    }
  else
    {
      show_vbbox_dialog (data);
      return NULL;
    }
}
Ejemplo n.º 6
0
Archivo: gui.c Proyecto: MufriA/stoken
static GtkWidget *create_app_window(void)
{
	GtkWidget *window, *vbox, *parent, *widget;

	window = app_window_common();

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	/* tokencode frame */
	parent = gtk_frame_new("Tokencode");
	gtk_box_pack_start(GTK_BOX(vbox), parent, FALSE, FALSE, 0);

	widget = gtk_table_new(5, 3, TRUE);
	gtk_container_add(GTK_CONTAINER(parent), widget);
	parent = widget;

	gtk_table_attach_defaults(GTK_TABLE(parent), tokencode_text,
		0, 3, 2, 3);

	/* progress bar */
	progress_bar = gtk_progress_bar_new();
	gtk_box_pack_start(GTK_BOX(vbox), progress_bar, FALSE, FALSE, 0);

	widget = gtk_hseparator_new();
	gtk_widget_set_size_request(widget, 200, 50);
	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);

	/* buttons */
	parent = gtk_vbutton_box_new();
	gtk_box_set_spacing(GTK_BOX(parent), 10);
	gtk_box_pack_start(GTK_BOX(vbox), parent, FALSE, FALSE, 0);

	widget = gtk_button_new_with_mnemonic("_Copy to clipboard");
	g_signal_connect(widget, "clicked", G_CALLBACK(clipboard_callback),
		NULL);
	gtk_container_add(GTK_CONTAINER(parent), widget);

	widget = gtk_button_new_with_mnemonic("_Quit");
	g_signal_connect_swapped(widget, "clicked", G_CALLBACK(gtk_main_quit),
				 window);
	gtk_container_add(GTK_CONTAINER(parent), widget);

	return window;
}
Ejemplo n.º 7
0
static void mimeview_show_signature_part(MimeView *mimeview,
					 MimeInfo *partinfo)
{
	TextView *textview = mimeview->textview;
	GtkTextBuffer *buffer;
	GtkTextIter iter;
	GtkTextChildAnchor *anchor;
	GtkWidget *vbbox;
	GtkWidget *button;

	if (!partinfo) return;

	textview_set_font(textview, NULL);
	textview_clear(textview);

	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
	gtk_text_buffer_get_start_iter(buffer, &iter);

	if (partinfo->sigstatus_full) {
		gtk_text_buffer_insert
			(buffer, &iter, partinfo->sigstatus_full, -1);
		return;
	}

	gtk_text_buffer_insert
		(buffer, &iter,
		 _("This signature has not been checked yet.\n\n"), -1);

	vbbox = gtk_vbutton_box_new();
	gtk_box_set_spacing(GTK_BOX(vbbox), 5);

	if (rfc2015_is_available()) {
		button = gtk_button_new_with_mnemonic(_("_Check signature"));
		gtk_container_add(GTK_CONTAINER(vbbox), button);
		g_signal_connect(button, "clicked",
				 G_CALLBACK(check_signature_button_clicked),
				 mimeview);
	}

	gtk_widget_show_all(vbbox);

	anchor = gtk_text_buffer_create_child_anchor(buffer, &iter);
	gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(textview->text),
					  vbbox, anchor);
}
Ejemplo n.º 8
0
/**** VBUTTONBOX constructor ****/
int
clip_GTK_VBUTTONBOXNEW(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   GtkWidget *wid = NULL;

   C_widget *cwid;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   wid = gtk_vbutton_box_new();
   if (!wid)
      goto err;
   cwid = _register_widget(ClipMachineMemory, wid, cv);
   _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);
   return 0;
 err:
   return 1;
}
Ejemplo n.º 9
0
/* 用指定的参数创建一个按钮盒 */
GtkWidget *create_bbox( gint  horizontal,
                        char *title,
                        gint  spacing,
                        gint  child_w,
                        gint  child_h,
                        gint  layout )
{
  GtkWidget *frame;
  GtkWidget *bbox;
  GtkWidget *button;

  frame = gtk_frame_new (title);

  if (horizontal)
    bbox = gtk_hbutton_box_new ();
  else
    bbox = gtk_vbutton_box_new ();

  gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
  gtk_container_add (GTK_CONTAINER (frame), bbox);

  /* 设置按钮盒的外观 */
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
  gtk_box_set_spacing (GTK_BOX (bbox), spacing);
  /*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/

  button = gtk_button_new_from_stock (GTK_STOCK_OK);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  button = gtk_button_new_from_stock (GTK_STOCK_HELP);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  return frame;
}
Ejemplo n.º 10
0
static void
vnr_message_area_initialize(VnrMessageArea * msg_area)
{
    msg_area->with_button = FALSE;
    msg_area->hbox = gtk_hbox_new(FALSE, 7);
    gtk_container_add(GTK_CONTAINER (msg_area), msg_area->hbox);
    gtk_container_set_border_width(GTK_CONTAINER (msg_area->hbox), 7);

    msg_area->image = gtk_image_new();
    gtk_box_pack_start (GTK_BOX (msg_area->hbox), msg_area->image,
                        FALSE, FALSE, 0);

    msg_area->message = gtk_label_new (NULL);
    gtk_label_set_line_wrap(GTK_LABEL (msg_area->message), TRUE);
    gtk_label_set_selectable(GTK_LABEL(msg_area->message), TRUE);
    gtk_box_pack_start (GTK_BOX (msg_area->hbox), msg_area->message,
                        FALSE, FALSE, 0);

    msg_area->button_box = gtk_vbutton_box_new();
    gtk_box_pack_end(GTK_BOX (msg_area->hbox), msg_area->button_box,
                     FALSE, FALSE, 0);

    msg_area->user_button = gtk_button_new();
    gtk_container_add(GTK_CONTAINER(msg_area->button_box),
                      msg_area->user_button);

    msg_area->cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
    g_signal_connect(msg_area->cancel_button, "clicked",
                     G_CALLBACK(cancel_button_cb), msg_area);
    gtk_container_add(GTK_CONTAINER(msg_area->button_box),
                      msg_area->cancel_button);

    gtk_widget_hide_all(msg_area->hbox);
    gtk_widget_set_state(GTK_WIDGET(msg_area), GTK_STATE_SELECTED);
    gtk_widget_set_state(msg_area->button_box, GTK_STATE_NORMAL);
    msg_area->initialized = TRUE;
}
/* create a dialog widget from scratch */
static void
gm_audio_profiles_edit_init (GMAudioProfilesEdit *dialog)
{
  GtkDialog *gdialog = GTK_DIALOG (dialog);
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *sw;
  GtkWidget *hbox;
  GtkWidget *bbox;
  GtkWidget *button;
  GtkTreeSelection *selection;

  /*
  dialog =
    gtk_dialog_new_with_buttons (_("Edit Profiles"),
                                 NULL,
                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                 GTK_STOCK_HELP,
                                 GTK_RESPONSE_HELP,
                                 GTK_STOCK_CLOSE,
                                 GTK_RESPONSE_ACCEPT,
                                 NULL);
  */
                                 // FIXME: GTK_DIALOG_DESTROY_WITH_PARENT,
  dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog, GM_AUDIO_TYPE_PROFILES_EDIT, GMAudioProfilesEditPrivate);

  gtk_window_set_title (GTK_WINDOW (dialog), _("Edit MATE Audio Profiles"));
  gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 240);
  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                                 GTK_STOCK_HELP,
                                 GTK_RESPONSE_HELP,
                                 GTK_STOCK_CLOSE,
                                 GTK_RESPONSE_ACCEPT,
                                 NULL);

  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (gdialog)), 2); /* 2 * 5 + 2 = 12 */
  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (gdialog)), 5);
  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (gdialog)), 6);

  g_signal_connect (GTK_DIALOG (dialog),
                    "response",
                    G_CALLBACK (on_gm_audio_profiles_edit_response),
                    NULL);

  g_signal_connect (G_OBJECT (dialog),
                    "destroy",
                    G_CALLBACK (on_gm_audio_profiles_edit_destroy),
                    NULL);

  vbox = gtk_vbox_new (FALSE, 6);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (gdialog)),
                      vbox, TRUE, TRUE, 0);

  /* FIXME
  hbox = gtk_hbox_new (FALSE, PADDING);
  gtk_box_pack_end (GTK_BOX (vbox),
                    hbox, FALSE, FALSE, 0);

  app->manage_profiles_default_menu = profile_optionmenu_new ();
  g_signal_connect (G_OBJECT (app->manage_profiles_default_menu),
                    "changed", G_CALLBACK (default_menu_changed),
                    app);

  gtk_box_pack_start (GTK_BOX (hbox),
                      label, TRUE, TRUE, 0);

  gtk_box_pack_end (GTK_BOX (hbox),
                    app->manage_profiles_default_menu, FALSE, FALSE, 0);
  */

  hbox = gtk_hbox_new (FALSE, 6);

  label = gtk_label_new_with_mnemonic (_("_Profiles:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

  gtk_box_pack_start (GTK_BOX (vbox),
                      hbox, TRUE, TRUE, 0);

  dialog->priv->manage_profiles_list = create_profile_list ();

  g_signal_connect (G_OBJECT (dialog->priv->manage_profiles_list),
                    "row_activated",
                    G_CALLBACK (profile_activated_callback),
                    NULL);

  sw = gtk_scrolled_window_new (NULL, NULL);
  /* FIXME
  terminal_util_set_labelled_by (GTK_WIDGET (dialog->priv->manage_profiles_list),
                                 GTK_LABEL (label));
  */

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
                                       GTK_SHADOW_IN);

  gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);

  gtk_container_add (GTK_CONTAINER (sw), dialog->priv->manage_profiles_list);

  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label),
                                 dialog->priv->manage_profiles_list);

  bbox = gtk_vbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
  gtk_box_set_spacing (GTK_BOX (bbox), 6);
  gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);

  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
  fix_button_align (button);
  gtk_box_pack_start (GTK_BOX (bbox),
                      button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (new_button_clicked), dialog);
  dialog->priv->new_button = button;
/*
  terminal_util_set_atk_name_description (dialog->priv->new_button, NULL,
                                          _("Click to open new profile dialog"));
*/

  gm_audio_profile_manage_register_stock ();

  button = gtk_button_new_from_stock (MANAGE_STOCK_EDIT);
  fix_button_align (button);
  gtk_box_pack_start (GTK_BOX (bbox),
                     button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (edit_button_clicked), dialog);
  gtk_widget_set_sensitive (button, FALSE);
  dialog->priv->edit_button = button;
/*
  terminal_util_set_atk_name_description (app->manage_profiles_edit_button, NULL,
                                          _("Click to open edit profile dialog"));
*/

  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
  fix_button_align (button);
  gtk_box_pack_start (GTK_BOX (bbox),
                      button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked",
                    G_CALLBACK (delete_button_clicked), dialog);
  gtk_widget_set_sensitive (button, FALSE);
  dialog->priv->delete_button = button;
/*
  terminal_util_set_atk_name_description (app->manage_profiles_delete_button, NULL,
                                          _("Click to delete selected profile"));
  */

  gtk_widget_grab_focus (dialog->priv->manage_profiles_list);

  /* Monitor selection for sensitivity */
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->manage_profiles_list));

  selection_changed_callback (selection, dialog->priv);
  g_signal_connect (G_OBJECT (selection), "changed",
                    G_CALLBACK (selection_changed_callback),
                    dialog->priv);
}
void Operator_manage(GtkWidget * UNUSED(widget), GtkWindow * parent) {
    GtkWidget * dialog;
    GtkWidget *hbox;
    GtkWidget * bbox;
    GtkWidget * sw;
    GtkTreeModel * model;
    GtkWidget *treeview;
    GtkWidget * button;
    GtkCellRenderer * renderer;
    GtkTreeViewColumn *column;

    /** Creation de la fenêtre principale */
    dialog = gtk_dialog_new_with_buttons("Gestion des opérateurs", parent, GTK_DIALOG_MODAL
            | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);

    gtk_container_set_border_width(GTK_CONTAINER (dialog), 5);

    hbox = gtk_hbox_new(FALSE, 5);
    gtk_box_pack_start(GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 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 (hbox), sw, TRUE, TRUE, 0);

    model = gtk_tree_model_sort_new_with_model(Operator_loadModel());

    /* 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), 0);

    renderer = gtk_cell_renderer_text_new();

    column = gtk_tree_view_column_new();
    gtk_tree_view_column_set_title(column, "Opérateur");
    gtk_tree_view_column_pack_start(column, renderer, TRUE);
    gtk_tree_view_column_add_attribute(column, renderer, "text", 0);
    gtk_tree_view_column_set_resizable(column, TRUE);
    gtk_tree_view_column_set_min_width(column, 300);
    gtk_tree_view_column_set_sort_column_id(column, 0);
    gtk_tree_view_column_set_alignment(column, 0.5);
    gtk_cell_renderer_set_alignment(renderer, 0, 0.5);
    gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column);

    gtk_widget_set_size_request(sw, 350, 400);
    gtk_widget_show(treeview);

    g_object_unref(model);

    gtk_container_add(GTK_CONTAINER (sw), treeview);

    bbox = gtk_vbutton_box_new();
    gtk_button_box_set_layout(GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
    gtk_box_set_spacing(GTK_BOX (bbox), 5);
    gtk_box_pack_start(GTK_BOX (hbox), bbox, TRUE, TRUE, 0);
    gtk_widget_show(bbox);

    button = gtk_button_new_with_label("Ajouter");
    g_signal_connect (button, "clicked", G_CALLBACK (Operator_add), treeview);
    gtk_container_add(GTK_CONTAINER (bbox), button);
    gtk_widget_show(button);

    button = gtk_button_new_with_label("Supprimer");
    g_signal_connect (button, "clicked", G_CALLBACK (Operator_delete), treeview);
    gtk_container_add(GTK_CONTAINER (bbox), button);
    gtk_widget_show(button);

    button = gtk_button_new_with_label("Modifier");
    g_signal_connect (button, "clicked", G_CALLBACK (Operator_modify), treeview);
    gtk_container_add(GTK_CONTAINER (bbox), button);

    gtk_widget_show_all(hbox);

    gtk_dialog_run(GTK_DIALOG (dialog));
    gtk_widget_destroy(dialog);

}
void
ephy_permissions_dialog_add_tab (EphyPermissionsDialog *dialog,
				 const char *type,
				 const char *title)
{
	EphyPermissionsDialogPrivate *priv = dialog->priv;
	GtkWidget *hbox, *view, *vbuttonbox, *button;
	GtkListStore *store;
	GtkCellRenderer *renderer;
	GtkTreeView *treeview;
	GtkTreeViewColumn *column;
	GtkTreeSelection *selection;
	DialogTab *tab;

	tab = g_new0 (DialogTab, 1);
	tab->dialog = dialog;
	tab->type = g_strdup (type);
	tab->qtype = g_quark_from_string (type);
	tab->filled = FALSE;
	
	priv->tabs = g_list_prepend (priv->tabs, tab);

	hbox = gtk_hbox_new (FALSE, 12);
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
	g_object_set_data (G_OBJECT (hbox), TAB_DATA_KEY, tab);

	view = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view),
					GTK_POLICY_NEVER /* FIXME? */,
					GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view),
					     GTK_SHADOW_IN);
	gtk_box_pack_start (GTK_BOX (hbox), view, TRUE, TRUE, 0);

	tab->store = store = gtk_list_store_new (2,
						 G_TYPE_STRING,
						 G_TYPE_STRING);
	tab->model = GTK_TREE_MODEL (store);

	tab->treeview = treeview = GTK_TREE_VIEW (gtk_tree_view_new_with_model (tab->model));
	g_object_unref (store);

	g_signal_connect (treeview, "key-press-event",
			  G_CALLBACK (treeview_key_press_event_cb), tab);

	gtk_tree_view_set_headers_visible (treeview, TRUE);

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (treeview,
						     COL_HOST,
						     _("Domain"),
						     renderer,
						     "text", COL_HOST,
						     NULL);
	column = gtk_tree_view_get_column (treeview, COL_HOST);
	gtk_tree_view_column_set_resizable (column, TRUE);
	gtk_tree_view_column_set_reorderable (column, TRUE);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
	gtk_tree_view_column_set_sort_column_id (column, COL_HOST);

	gtk_tree_view_insert_column_with_attributes (treeview,
						     COL_PERM,
						     _("State"),
						     renderer,
						     "text", COL_PERM,
						     NULL);
	column = gtk_tree_view_get_column (treeview, COL_PERM);
	gtk_tree_view_column_set_resizable (column, TRUE);
	gtk_tree_view_column_set_reorderable (column, TRUE);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
	gtk_tree_view_column_set_sort_column_id (column, COL_PERM);

	gtk_container_add (GTK_CONTAINER (view), GTK_WIDGET (treeview));

	tab->selection = selection = gtk_tree_view_get_selection (treeview);
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
	g_signal_connect (selection, "changed",
			  G_CALLBACK (treeview_selection_changed_cb), tab);

	/* Button box */
	vbuttonbox = gtk_vbutton_box_new ();
	gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox),
				   GTK_BUTTONBOX_START);
	gtk_box_pack_start (GTK_BOX (hbox), vbuttonbox, FALSE, FALSE, 0);

	/* Remove button */
	tab->remove_button = button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
	g_signal_connect (button, "clicked",
			  G_CALLBACK (remove_button_clicked_cb), tab);
	gtk_box_pack_start (GTK_BOX (vbuttonbox), button, FALSE, FALSE, 0);

	gtk_size_group_add_widget (priv->buttons_size_group, button);

	gtk_widget_show_all (hbox);

	/* And finally insert it in the notebook */
	gtk_notebook_append_page (priv->notebook, hbox,
				  gtk_label_new (title));
}
Ejemplo n.º 14
0
void
exchange_delegates (ExchangeAccount *account,
                    GtkWidget *parent)
{
	GtkWidget *dialog_vbox1;
	GtkWidget *vbox2;
	GtkWidget *label3;
	GtkWidget *delegate_hbox;
	GtkWidget *delegates_table;
	GtkWidget *vbuttonbox1;
	GtkWidget *add_button;
	GtkWidget *edit_button;
	GtkWidget *remove_button;
	ExchangeDelegates *delegates;
	ExchangeDelegatesUser *user;
	GtkTreeViewColumn *column;
	GtkTreeIter iter;
	gint i;

	g_return_if_fail (GTK_IS_WIDGET (parent));
	g_return_if_fail (EXCHANGE_IS_ACCOUNT (account));

	delegates = g_new0 (ExchangeDelegates, 1);
	delegates->account = g_object_ref (account);

	delegates->dialog = gtk_dialog_new_with_buttons (
		_("Delegates"),
		NULL,
		GTK_DIALOG_DESTROY_WITH_PARENT,
		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
		GTK_STOCK_OK, GTK_RESPONSE_OK,
		NULL);

	dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (delegates->dialog));
	gtk_widget_show (dialog_vbox1);

	vbox2 = gtk_vbox_new (FALSE, 6);
	gtk_widget_show (vbox2);
	gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox2, TRUE, TRUE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);

	label3 = gtk_label_new (_("These users will be able to send mail on your behalf\nand access your folders with the permissions you give them."));
	gtk_widget_show (label3);
	gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0);

	delegate_hbox = gtk_hbox_new (FALSE, 6);
	gtk_widget_show (delegate_hbox);
	gtk_box_pack_start (GTK_BOX (vbox2), delegate_hbox, TRUE, TRUE, 0);

	delegates_table = gtk_tree_view_new ();
	gtk_widget_show (delegates_table);
	gtk_box_pack_start (GTK_BOX (delegate_hbox), delegates_table, TRUE, TRUE, 0);
	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (delegates_table), FALSE);

	vbuttonbox1 = gtk_vbutton_box_new ();
	gtk_widget_show (vbuttonbox1);
	gtk_box_pack_end (GTK_BOX (delegate_hbox), vbuttonbox1, FALSE, TRUE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START);
	gtk_box_set_spacing (GTK_BOX (vbuttonbox1), 6);

	add_button = gtk_button_new_from_stock ("gtk-add");
	gtk_widget_show (add_button);
	gtk_container_add (GTK_CONTAINER (vbuttonbox1), add_button);
	gtk_widget_set_can_default (add_button, TRUE);

	edit_button = gtk_button_new_with_mnemonic (_("_Edit"));
	gtk_widget_show (edit_button);
	gtk_container_add (GTK_CONTAINER (vbuttonbox1), edit_button);
	gtk_widget_set_can_default (edit_button, TRUE);

	remove_button = gtk_button_new_from_stock ("gtk-remove");
	gtk_widget_show (remove_button);
	gtk_container_add (GTK_CONTAINER (vbuttonbox1), remove_button);
	gtk_widget_set_can_default (remove_button, TRUE);

	g_signal_connect (delegates->dialog, "response",
			  G_CALLBACK (dialog_response), delegates);

	if (parent)
		gtk_window_set_transient_for (GTK_WINDOW (delegates->dialog), GTK_WINDOW (parent));
	delegates->parent = parent;
	g_object_weak_ref (G_OBJECT (parent), parent_destroyed, delegates);

	/* Set up the buttons */
	g_signal_connect (add_button, "clicked",
			  G_CALLBACK (add_button_clicked_cb), delegates);
	g_signal_connect (edit_button, "clicked",
			  G_CALLBACK (edit_button_clicked_cb), delegates);
	g_signal_connect (remove_button, "clicked",
			  G_CALLBACK (remove_button_clicked_cb), delegates);

	/* Set up the table */
	delegates->model = gtk_list_store_new (1, G_TYPE_STRING);
	delegates->table = delegates_table;
	column = gtk_tree_view_column_new_with_attributes (
		_("Name"), gtk_cell_renderer_text_new (), "text", 0, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (delegates->table),
				     column);
	gtk_tree_view_set_model (GTK_TREE_VIEW (delegates->table),
				 GTK_TREE_MODEL (delegates->model));

	/* Get list of delegate users */
	if (get_user_list (delegates)) {
		for (i = 0; i < delegates->users->len; i++) {
			user = delegates->users->pdata[i];

			gtk_list_store_append (delegates->model, &iter);
			gtk_list_store_set (delegates->model, &iter,
					    0, user->display_name,
					    -1);
		}
		g_signal_connect (delegates->table,
				  "button_press_event",
				  G_CALLBACK (table_click_cb), delegates);
	} else {
		gtk_widget_set_sensitive (add_button, FALSE);
		gtk_widget_set_sensitive (edit_button, FALSE);
		gtk_widget_set_sensitive (remove_button, FALSE);

		gtk_list_store_append (delegates->model, &iter);
		gtk_list_store_set (delegates->model, &iter,
				    0, _("Error reading delegates list."),
				    -1);
	}

	gtk_widget_show (delegates->dialog);
}
Ejemplo n.º 15
0
GtkWidget*
create_windowPreferences (void)
{
  GtkWidget *windowPreferences;
  GtkWidget *vboxPrefs;
  GtkWidget *hboxUserName;
  GtkWidget *labelUserName;
  GtkWidget *entryUserName;
  GtkWidget *hbuttonboxBtns;
  GtkWidget *buttonCancel;
  GtkWidget *buttonApply;
  GtkWidget *hbox1;
  GtkWidget *vbox2;
  GtkWidget *frameHabits;
  GtkWidget *hbox3;
  GtkWidget *vbox3;
  GtkWidget *treeviewHabits;
  GtkWidget *vbuttonboxHabits;
  GtkWidget *buttonAddHabit;
  GtkWidget *buttonRemoveHabit;
  GtkWidget *buttonEditHabit;
  GtkWidget *label11;

  windowPreferences = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (windowPreferences, "windowPreferences");
  gtk_window_set_title (GTK_WINDOW (windowPreferences), "Preferences");
  gtk_window_set_resizable (GTK_WINDOW (windowPreferences), FALSE);

  vboxPrefs = gtk_vbox_new (FALSE, 5);
  gtk_widget_set_name (vboxPrefs, "vboxPrefs");
  gtk_widget_show (vboxPrefs);
  gtk_container_add (GTK_CONTAINER (windowPreferences), vboxPrefs);
  gtk_container_set_border_width (GTK_CONTAINER (vboxPrefs), 3);

  hboxUserName = gtk_hbox_new (FALSE, 5);
  gtk_widget_set_name (hboxUserName, "hboxUserName");
  gtk_widget_show (hboxUserName);
  gtk_box_pack_start (GTK_BOX (vboxPrefs), hboxUserName, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hboxUserName), 3);

  labelUserName = gtk_label_new ("User name");
  gtk_widget_set_name (labelUserName, "labelUserName");
  gtk_widget_show (labelUserName);
  gtk_box_pack_start (GTK_BOX (hboxUserName), labelUserName, FALSE, FALSE, 0);

  entryUserName = gtk_entry_new ();
  gtk_widget_set_name (entryUserName, "entryUserName");
  gtk_widget_show (entryUserName);
  gtk_box_pack_start (GTK_BOX (hboxUserName), entryUserName, FALSE, FALSE, 0);
  gtk_entry_set_max_length (GTK_ENTRY (entryUserName), 20);
  gtk_entry_set_width_chars (GTK_ENTRY (entryUserName), 21);

  hbuttonboxBtns = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonboxBtns, "hbuttonboxBtns");
  gtk_widget_show (hbuttonboxBtns);
  gtk_box_pack_end (GTK_BOX (vboxPrefs), hbuttonboxBtns, FALSE, FALSE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonboxBtns), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (hbuttonboxBtns), 5);

  buttonCancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_set_name (buttonCancel, "buttonCancel");
  gtk_widget_show (buttonCancel);
  gtk_container_add (GTK_CONTAINER (hbuttonboxBtns), buttonCancel);
  GTK_WIDGET_SET_FLAGS (buttonCancel, GTK_CAN_DEFAULT);

  buttonApply = gtk_button_new_from_stock ("gtk-apply");
  gtk_widget_set_name (buttonApply, "buttonApply");
  gtk_widget_show (buttonApply);
  gtk_container_add (GTK_CONTAINER (hbuttonboxBtns), buttonApply);
  GTK_WIDGET_SET_FLAGS (buttonApply, GTK_CAN_DEFAULT);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox1, "hbox1");
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vboxPrefs), hbox1, TRUE, TRUE, 0);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox2, "vbox2");
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);

  frameHabits = gtk_frame_new (NULL);
  gtk_widget_set_name (frameHabits, "frameHabits");
  gtk_widget_show (frameHabits);
  gtk_box_pack_start (GTK_BOX (vbox2), frameHabits, TRUE, TRUE, 0);

  hbox3 = gtk_hbox_new (FALSE, 5);
  gtk_widget_set_name (hbox3, "hbox3");
  gtk_widget_show (hbox3);
  gtk_container_add (GTK_CONTAINER (frameHabits), hbox3);
  gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox3, "vbox3");
  gtk_widget_show (vbox3);
  gtk_box_pack_start (GTK_BOX (hbox3), vbox3, TRUE, TRUE, 0);

  treeviewHabits = gtk_tree_view_new ();
  gtk_widget_set_name (treeviewHabits, "treeviewHabits");
  gtk_widget_show (treeviewHabits);
  gtk_box_pack_start (GTK_BOX (vbox3), treeviewHabits, TRUE, TRUE, 0);

  vbuttonboxHabits = gtk_vbutton_box_new ();
  gtk_widget_set_name (vbuttonboxHabits, "vbuttonboxHabits");
  gtk_widget_show (vbuttonboxHabits);
  gtk_box_pack_start (GTK_BOX (hbox3), vbuttonboxHabits, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonboxHabits), GTK_BUTTONBOX_START);

  buttonAddHabit = gtk_button_new_from_stock ("gtk-add");
  gtk_widget_set_name (buttonAddHabit, "buttonAddHabit");
  gtk_widget_show (buttonAddHabit);
  gtk_container_add (GTK_CONTAINER (vbuttonboxHabits), buttonAddHabit);
  GTK_WIDGET_SET_FLAGS (buttonAddHabit, GTK_CAN_DEFAULT);

  buttonRemoveHabit = gtk_button_new_from_stock ("gtk-remove");
  gtk_widget_set_name (buttonRemoveHabit, "buttonRemoveHabit");
  gtk_widget_show (buttonRemoveHabit);
  gtk_container_add (GTK_CONTAINER (vbuttonboxHabits), buttonRemoveHabit);
  gtk_widget_set_sensitive (buttonRemoveHabit, FALSE);
  GTK_WIDGET_SET_FLAGS (buttonRemoveHabit, GTK_CAN_DEFAULT);

  buttonEditHabit = gtk_button_new_from_stock ("gtk-properties");
  gtk_widget_set_name (buttonEditHabit, "buttonEditHabit");
  gtk_widget_show (buttonEditHabit);
  gtk_container_add (GTK_CONTAINER (vbuttonboxHabits), buttonEditHabit);
  gtk_widget_set_sensitive (buttonEditHabit, FALSE);
  GTK_WIDGET_SET_FLAGS (buttonEditHabit, GTK_CAN_DEFAULT);

  label11 = gtk_label_new ("Habits");
  gtk_widget_set_name (label11, "label11");
  gtk_widget_show (label11);
  gtk_frame_set_label_widget (GTK_FRAME (frameHabits), label11);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (windowPreferences, windowPreferences, "windowPreferences");
  GLADE_HOOKUP_OBJECT (windowPreferences, vboxPrefs, "vboxPrefs");
  GLADE_HOOKUP_OBJECT (windowPreferences, hboxUserName, "hboxUserName");
  GLADE_HOOKUP_OBJECT (windowPreferences, labelUserName, "labelUserName");
  GLADE_HOOKUP_OBJECT (windowPreferences, entryUserName, "entryUserName");
  GLADE_HOOKUP_OBJECT (windowPreferences, hbuttonboxBtns, "hbuttonboxBtns");
  GLADE_HOOKUP_OBJECT (windowPreferences, buttonCancel, "buttonCancel");
  GLADE_HOOKUP_OBJECT (windowPreferences, buttonApply, "buttonApply");
  GLADE_HOOKUP_OBJECT (windowPreferences, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (windowPreferences, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (windowPreferences, frameHabits, "frameHabits");
  GLADE_HOOKUP_OBJECT (windowPreferences, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (windowPreferences, vbox3, "vbox3");
  GLADE_HOOKUP_OBJECT (windowPreferences, treeviewHabits, "treeviewHabits");
  GLADE_HOOKUP_OBJECT (windowPreferences, vbuttonboxHabits, "vbuttonboxHabits");
  GLADE_HOOKUP_OBJECT (windowPreferences, buttonAddHabit, "buttonAddHabit");
  GLADE_HOOKUP_OBJECT (windowPreferences, buttonRemoveHabit, "buttonRemoveHabit");
  GLADE_HOOKUP_OBJECT (windowPreferences, buttonEditHabit, "buttonEditHabit");
  GLADE_HOOKUP_OBJECT (windowPreferences, label11, "label11");

  return windowPreferences;
}
Ejemplo n.º 16
0
int main( int   argc,
          char *argv[] )
{
    GtkWidget *window, *hbox, *vbox, *bbox, *checkbox, *text_view, *button;
    GtkWidget *radio1, *radio2, *rbbox, *frame;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW(window), 320, 240);

    /* It's a good idea to do this for all windows. */
    g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (gtk_main_quit), NULL);

    g_signal_connect (G_OBJECT (window), "delete_event",
                      G_CALLBACK (gtk_main_quit), NULL);

    hbox = gtk_hbox_new (FALSE, 0);
    my_vbox = my_vbox_new (FALSE, 0);
    vbox = gtk_vbox_new (FALSE, 0);

    gtk_container_add (GTK_CONTAINER (hbox), my_vbox);

    /* Some widgets to test with MyVBox */
    widget1 = gtk_hbutton_box_new ();
    button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
    g_signal_connect (button, "clicked",
                      G_CALLBACK (save_cb), "save");
    gtk_container_add (GTK_CONTAINER (widget1), button);

    button = gtk_button_new_from_stock (GTK_STOCK_SAVE_AS);
    g_signal_connect (button, "clicked",
                      G_CALLBACK (save_cb), "save as");
    gtk_container_add (GTK_CONTAINER (widget1), button);

    widget2 = gtk_frame_new ("Text");
    text_buffer = gtk_text_buffer_new (NULL);
    text_view = gtk_text_view_new_with_buffer (text_buffer);
    gtk_container_add (GTK_CONTAINER (widget2), text_view);

    widget3 = gtk_vbutton_box_new ();
    button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
    g_signal_connect (button, "clicked",
                      G_CALLBACK (delete_cb), NULL);
    gtk_container_add (GTK_CONTAINER (widget3), button);

    button = gtk_button_new_from_stock (GTK_STOCK_UNDELETE);
    g_signal_connect (button, "clicked",
                      G_CALLBACK (undo_cb), NULL);
    gtk_container_add (GTK_CONTAINER (widget3), button);

    /* Show the widgets and attach them later */
    gtk_widget_show_all (widget1);
    gtk_widget_show_all (widget2);
    gtk_widget_show_all (widget3);

    /* Add checkboxes to the vbox */
    bbox = gtk_vbutton_box_new ();
    checkbox = gtk_check_button_new_with_label ("Save");
    g_signal_connect (checkbox, "toggled",
                      G_CALLBACK (button_cb), GINT_TO_POINTER (1));
    gtk_container_add (GTK_CONTAINER (bbox),
                       checkbox);
    checkbox = gtk_check_button_new_with_label ("Text");
    g_signal_connect (checkbox, "toggled",
                      G_CALLBACK (button_cb), GINT_TO_POINTER (2));
    gtk_container_add (GTK_CONTAINER (bbox),
                       checkbox);
    checkbox = gtk_check_button_new_with_label ("Edit");
    g_signal_connect (checkbox, "toggled",
                      G_CALLBACK (button_cb), GINT_TO_POINTER (4));
    gtk_container_add (GTK_CONTAINER (bbox),
                       checkbox);

    /* Add radio buttons to select the animation style */
    frame = gtk_frame_new ("Animation mode");
    rbbox = gtk_hbutton_box_new ();
    radio1 = gtk_radio_button_new_with_label (NULL, "Move");
    g_signal_connect (radio1, "toggled",
                      G_CALLBACK (select_animation_cb), "move");
    gtk_container_add (GTK_CONTAINER (rbbox),
                       radio1);
    radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1), "Resize");
    g_signal_connect (radio2, "toggled",
                      G_CALLBACK (select_animation_cb), "resize");
    gtk_container_add (GTK_CONTAINER (rbbox),
                       radio2);

    gtk_container_add (GTK_CONTAINER (frame), rbbox);

    gtk_container_add (GTK_CONTAINER (bbox), frame);

    gtk_container_add (GTK_CONTAINER (vbox), bbox);

    /* Add vbox to the hbox */
    gtk_container_add (GTK_CONTAINER (hbox), vbox);

    gtk_container_add (GTK_CONTAINER (window), hbox);

    gtk_widget_show_all (window);

    gtk_main ();

    return 0;
}
Ejemplo n.º 17
0
static void create_adapter(adapter_data *adapter)
{
	GHashTable *hash = NULL;
	GValue *value;
	DBusGProxy *default_proxy;
	const gchar *name;
	gboolean powered, discoverable;
	guint timeout;

	GtkWidget *mainbox;
	GtkWidget *vbox;
	GtkWidget *alignment;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *image;
	GtkWidget *button;
	GtkWidget *entry;
	GtkWidget *buttonbox;
	int page_num;

	dbus_g_proxy_call(adapter->proxy, "GetProperties", NULL, G_TYPE_INVALID,
				dbus_g_type_get_map("GHashTable",
						G_TYPE_STRING, G_TYPE_VALUE),
				&hash, G_TYPE_INVALID);

	if (hash != NULL) {
		value = g_hash_table_lookup(hash, "Name");
		name = value ? g_value_get_string(value) : NULL;

		value = g_hash_table_lookup(hash, "Powered");
		powered = value ? g_value_get_boolean(value) : FALSE;

		value = g_hash_table_lookup(hash, "Discoverable");
		discoverable = value ? g_value_get_boolean(value) : FALSE;

		value = g_hash_table_lookup(hash, "DiscoverableTimeout");
		timeout = value ? g_value_get_uint(value) : 0;
	} else {
		name = NULL;
		powered = FALSE;
		discoverable = FALSE;
		timeout = 0;
	}

	adapter->powered = powered;
	adapter->discoverable = discoverable;
	adapter->timeout_value = timeout;

	default_proxy = bluetooth_client_get_default_adapter (client);
	if (default_proxy != NULL) {
		adapter->is_default = g_str_equal (dbus_g_proxy_get_path (default_proxy),
						   dbus_g_proxy_get_path (adapter->proxy));
		g_object_unref (default_proxy);
	}

	mainbox = gtk_vbox_new(FALSE, 6);
	gtk_container_set_border_width(GTK_CONTAINER(mainbox), 12);

	page_num = gtk_notebook_prepend_page(GTK_NOTEBOOK(adapter->notebook),
							mainbox, NULL);

	adapter->child = mainbox;

	vbox = gtk_vbox_new(FALSE, 6);
	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, TRUE, 0);

	/* The discoverable checkbox */
	button = gtk_check_button_new_with_mnemonic (_("Make computer _visible"));
	if (powered == FALSE)
		discoverable = FALSE;
	if (discoverable != FALSE && timeout == 0)
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
	else if (discoverable == FALSE)
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
	else {
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
		gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button), TRUE);
	}
	gtk_widget_set_sensitive (button, adapter->powered);

	adapter->button_discoverable = button;
	adapter->signal_discoverable = g_signal_connect(G_OBJECT(button), "toggled",
							G_CALLBACK(discoverable_changed_cb), adapter);

	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);

	/* The friendly name */
	vbox = gtk_vbox_new(FALSE, 6);
	gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);

	label = create_label(_("Friendly name"));
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
	gtk_widget_show (alignment);
	gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0);
	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

	entry = gtk_entry_new();
	gtk_entry_set_max_length(GTK_ENTRY(entry), 248);
	gtk_widget_set_size_request(entry, 240, -1);
	gtk_container_add (GTK_CONTAINER (alignment), entry);

	if (name != NULL)
		gtk_entry_set_text(GTK_ENTRY(entry), name);

	adapter->entry = entry;
	adapter->name_vbox = vbox;

	g_signal_connect(G_OBJECT(entry), "changed",
					G_CALLBACK(name_callback), adapter);
	g_signal_connect(G_OBJECT(entry), "focus-out-event",
					G_CALLBACK(focus_callback), adapter);

	gtk_widget_set_sensitive (adapter->name_vbox, adapter->powered);

	/* The known devices */
	table = gtk_table_new(2, 2, FALSE);
	gtk_box_pack_start(GTK_BOX(mainbox), table, TRUE, TRUE, 0);

	label = create_label(_("Devices"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, 0, 1,
			 GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 6);

	/* Note that this will only ever show the devices on the default
	 * adapter, this is on purpose */
	adapter->chooser = bluetooth_chooser_new (NULL);
	g_object_set (adapter->chooser,
		      "show-searching", FALSE,
		      "show-device-type", FALSE,
		      "show-device-category", FALSE,
		      "show-pairing", TRUE,
		      "show-connected", TRUE,
		      "device-category-filter", BLUETOOTH_CATEGORY_PAIRED_OR_TRUSTED,
		      NULL);

	g_signal_connect (adapter->chooser, "notify::device-selected",
			  G_CALLBACK(device_selected_cb), adapter);

	gtk_table_attach(GTK_TABLE(table), adapter->chooser, 0, 1, 1, 2,
			 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);

	adapter->devices_table = table;

	buttonbox = gtk_vbutton_box_new();
	gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox),
						GTK_BUTTONBOX_START);
	gtk_box_set_spacing(GTK_BOX(buttonbox), 6);
	gtk_box_set_homogeneous(GTK_BOX(buttonbox), FALSE);
	gtk_table_attach(GTK_TABLE(table), buttonbox, 1, 2, 1, 2,
			 GTK_FILL, GTK_FILL, 6, 6);

	button = gtk_button_new_with_mnemonic(_("Set up _new device..."));
	image = gtk_image_new_from_stock(GTK_STOCK_ADD,
						GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image(GTK_BUTTON(button), image);
	gtk_box_pack_start(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);

	g_signal_connect(G_OBJECT(button), "clicked",
				G_CALLBACK(wizard_callback), adapter);

	button = gtk_button_new_with_label(_("Disconnect"));
	image = gtk_image_new_from_stock(GTK_STOCK_DISCONNECT,
						GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image(GTK_BUTTON(button), image);
	gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
	gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
								button, TRUE);
	gtk_widget_set_sensitive(button, FALSE);

	g_signal_connect(G_OBJECT(button), "clicked",
				G_CALLBACK(disconnect_callback), adapter);

	adapter->button_disconnect = button;

	button = gtk_button_new_with_mnemonic(_("_Remove"));
	image = gtk_image_new_from_stock(GTK_STOCK_REMOVE,
						GTK_ICON_SIZE_BUTTON);
	gtk_button_set_image(GTK_BUTTON(button), image);
	gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
	gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
								button, TRUE);
	gtk_widget_set_sensitive(button, FALSE);

	g_signal_connect(G_OBJECT(button), "clicked",
				G_CALLBACK(remove_callback), adapter);

	adapter->button_delete = button;

	gtk_widget_set_sensitive (adapter->devices_table, adapter->powered);

	g_object_set_data(G_OBJECT(mainbox), "adapter", adapter);

	gtk_widget_show_all(mainbox);

	if (adapter->is_default != FALSE)
		gtk_notebook_set_current_page (GTK_NOTEBOOK (adapter->notebook), page_num);
}
Ejemplo n.º 18
0
CEmoticonDlg::CEmoticonDlg(CWidget* parent) : m_IsModified(false)
// : CDialog( parent, _("Emoticons"), true )
{
	m_Widget = gtk_dialog_new_with_buttons(_("Emoticons"),
		GTK_WINDOW(parent->m_Widget),
		GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),  _("Send"), GTK_RESPONSE_OK, GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL, NULL);

	gtk_dialog_set_default_response(GTK_DIALOG(m_Widget), GTK_RESPONSE_OK );

	gtk_window_set_type_hint (GTK_WINDOW (m_Widget), GDK_WINDOW_TYPE_HINT_DIALOG);

	PostCreate();

	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *emoticon_list_scrl;
	GtkWidget *emoticon_list;
	GtkWidget *vbtn_box;
	GtkWidget *add_btn;
	GtkWidget *edit_btn;
	GtkWidget *remove_btn;
	GtkWidget *up_btn;
	GtkWidget *down_btn;

	vbox = GTK_DIALOG (m_Widget)->vbox;
	gtk_widget_show (vbox);
	
	hbox = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
	
	emoticon_list_scrl = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (emoticon_list_scrl);
	gtk_box_pack_start (GTK_BOX (hbox), emoticon_list_scrl, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (emoticon_list_scrl), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (emoticon_list_scrl), GTK_SHADOW_IN);
	
	vbtn_box = gtk_vbutton_box_new ();
	gtk_widget_show (vbtn_box);
	gtk_box_pack_start (GTK_BOX (hbox), vbtn_box, FALSE, TRUE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (vbtn_box), GTK_BUTTONBOX_START);

	add_btn = gtk_button_new_from_stock ("gtk-add");
	gtk_widget_show (add_btn);
	gtk_container_add (GTK_CONTAINER (vbtn_box), add_btn);
	GTK_WIDGET_SET_FLAGS (add_btn, GTK_CAN_DEFAULT);
	
	edit_btn = gtk_button_new_from_stock ("gtk-edit");
	gtk_widget_show (edit_btn);
	gtk_container_add (GTK_CONTAINER (vbtn_box), edit_btn);
	GTK_WIDGET_SET_FLAGS (edit_btn, GTK_CAN_DEFAULT);
	
	remove_btn = gtk_button_new_from_stock ("gtk-remove");
	gtk_widget_show (remove_btn);
	gtk_container_add (GTK_CONTAINER (vbtn_box), remove_btn);
	GTK_WIDGET_SET_FLAGS (remove_btn, GTK_CAN_DEFAULT);
	
	up_btn = gtk_button_new_from_stock ("gtk-go-up");
	gtk_widget_show (up_btn);
	gtk_container_add (GTK_CONTAINER (vbtn_box), up_btn);
	GTK_WIDGET_SET_FLAGS (up_btn, GTK_CAN_DEFAULT);
	
	down_btn = gtk_button_new_from_stock ("gtk-go-down");
	gtk_widget_show (down_btn);
	gtk_container_add (GTK_CONTAINER (vbtn_box), down_btn);
	GTK_WIDGET_SET_FLAGS (down_btn, GTK_CAN_DEFAULT);
	
	g_signal_connect ((gpointer) add_btn, "clicked",
					G_CALLBACK (CEmoticonDlg::OnAdd),
					this);
	g_signal_connect ((gpointer) edit_btn, "clicked",
					G_CALLBACK (CEmoticonDlg::OnEdit),
					this);
	g_signal_connect ((gpointer) remove_btn, "clicked",
					G_CALLBACK (CEmoticonDlg::OnRemove),
					this);
	g_signal_connect ((gpointer) up_btn, "clicked",
					G_CALLBACK (CEmoticonDlg::OnUp),
					this);
	g_signal_connect ((gpointer) down_btn, "clicked",
					G_CALLBACK (CEmoticonDlg::OnDown),
					this);

	gtk_window_set_default_size((GtkWindow*)m_Widget, 512, 400);

	m_List = new CListBox;
	emoticon_list = m_List->m_Widget;
	gtk_widget_show (emoticon_list);
	gtk_container_add (GTK_CONTAINER (emoticon_list_scrl), emoticon_list);

	g_signal_connect(G_OBJECT(m_Widget), "response", G_CALLBACK(CDialog::OnResponse), this);

	g_signal_connect(G_OBJECT(m_List->m_Widget), "row-activated", G_CALLBACK(CEmoticonDlg::OnListRowActivated), this );

	LoadEmoticons();
}
Ejemplo n.º 19
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *hbox1;
  GtkWidget *scrolledwindow1;
  GtkWidget *treeview1;
  GtkWidget *vbuttonbox1;
  GtkWidget *buttonDeleteAll;
  GtkWidget *buttonDelete;
  GtkWidget *buttonRunAll;
  GtkWidget *buttonRun;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Jobs"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow1, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);

  treeview1 = gtk_tree_view_new ();
  gtk_widget_show (treeview1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview1);
  //gtk_widget_set_size_request (treeview1, 300, -1);

  vbuttonbox1 = gtk_vbutton_box_new ();
  gtk_widget_show (vbuttonbox1);
  gtk_box_pack_start (GTK_BOX (hbox1), vbuttonbox1, FALSE, FALSE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START);

  buttonDeleteAll = gtk_button_new_with_mnemonic (QT_TR_NOOP("Delete All Jobs"));
  gtk_widget_show (buttonDeleteAll);
  gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonDeleteAll);
  GTK_WIDGET_SET_FLAGS (buttonDeleteAll, GTK_CAN_DEFAULT);

  buttonDelete = gtk_button_new_with_mnemonic (QT_TR_NOOP("Delete Job"));
  gtk_widget_show (buttonDelete);
  gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonDelete);
  GTK_WIDGET_SET_FLAGS (buttonDelete, GTK_CAN_DEFAULT);

  buttonRunAll = gtk_button_new_with_mnemonic (QT_TR_NOOP("Run all jobs"));
  gtk_widget_show (buttonRunAll);
  gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonRunAll);
  GTK_WIDGET_SET_FLAGS (buttonRunAll, GTK_CAN_DEFAULT);

  buttonRun = gtk_button_new_with_mnemonic (QT_TR_NOOP("Run Job"));
  gtk_widget_show (buttonRun);
  gtk_container_add (GTK_CONTAINER (vbuttonbox1), buttonRun);
  GTK_WIDGET_SET_FLAGS (buttonRun, GTK_CAN_DEFAULT);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (dialog1, treeview1, "treeview1");
  GLADE_HOOKUP_OBJECT (dialog1, vbuttonbox1, "vbuttonbox1");
  GLADE_HOOKUP_OBJECT (dialog1, buttonDeleteAll, "buttonDeleteAll");
  GLADE_HOOKUP_OBJECT (dialog1, buttonDelete, "buttonDelete");
  GLADE_HOOKUP_OBJECT (dialog1, buttonRunAll, "buttonRunAll");
  GLADE_HOOKUP_OBJECT (dialog1, buttonRun, "buttonRun");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Ejemplo n.º 20
0
int
main (int argc, char **argv)
{
  GtkWidget *control_window;
  GtkWidget *vbbox;
  GtkWidget *button;
  GtkWidget *dialog;
  GtkWidget *prop_editor;
  GtkFileSystem *file_system;
  GtkFileFilter *filter;
  GtkWidget *preview_vbox;
  GtkWidget *extra;
  
  gtk_init (&argc, &argv);

#ifdef USE_GNOME_VFS
  file_system = gtk_file_system_gnome_vfs_new ();
#else  
  file_system = gtk_file_system_unix_new ();
#endif
  
  dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
			 "action", GTK_FILE_CHOOSER_ACTION_OPEN,
			 "file-system", file_system,
			 "title", "Select a file",
			 NULL);
			 
  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
			  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
			  GTK_STOCK_OPEN, GTK_RESPONSE_OK,
			  NULL);
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
  
  g_signal_connect (dialog, "selection-changed",
		    G_CALLBACK (print_selected), NULL);
  g_signal_connect (dialog, "current-folder-changed",
		    G_CALLBACK (print_current_folder), NULL);
  g_signal_connect (dialog, "response",
		    G_CALLBACK (response_cb), NULL);

  /* Filters */
  filter = gtk_file_filter_new ();
  gtk_file_filter_set_name (filter, "All Files");
  gtk_file_filter_add_pattern (filter, "*");
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
  
  filter = gtk_file_filter_new ();
  gtk_file_filter_set_name (filter, "No backup files");
  gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_DISPLAY_NAME,
			      no_backup_files_filter, NULL, NULL);
  gtk_file_filter_add_mime_type (filter, "image/png");
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);

  /* Make this filter the default */
  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
  
  filter = gtk_file_filter_new ();
  gtk_file_filter_set_name (filter, "PNG and JPEG");
  gtk_file_filter_add_mime_type (filter, "image/jpeg");
  gtk_file_filter_add_mime_type (filter, "image/png");
  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);

  /* Preview widget */
  preview_vbox = gtk_vbox_new (0, FALSE);
  gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog), preview_vbox);
  
  preview_label = gtk_label_new (NULL);
  gtk_box_pack_start (GTK_BOX (preview_vbox), preview_label, TRUE, TRUE, 0);
  gtk_misc_set_padding (GTK_MISC (preview_label), 6, 6);
  
  preview_image = gtk_image_new ();
  gtk_box_pack_start (GTK_BOX (preview_vbox), preview_image, TRUE, TRUE, 0);
  gtk_misc_set_padding (GTK_MISC (preview_image), 6, 6);
  
  update_preview_cb (GTK_FILE_CHOOSER (dialog));
  g_signal_connect (dialog, "update-preview",
		    G_CALLBACK (update_preview_cb), NULL);

  /* Extra widget */
  extra = gtk_check_button_new_with_mnemonic ("Lar_t whoever asks about this button");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra), TRUE);
  gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra);

  /* Shortcuts */

  gtk_file_chooser_add_shortcut_folder_uri (GTK_FILE_CHOOSER (dialog),
					    "file:///usr/share/pixmaps",
					    NULL);

  /* Done with the dialog */
  gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
  /* show_all() to reveal bugs in composite widget handling */
  gtk_widget_show_all (dialog);

  /* Extra controls for manipulating the test environment
   */
  prop_editor = create_prop_editor (G_OBJECT (dialog), GTK_TYPE_FILE_CHOOSER);

  control_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  
  vbbox = gtk_vbutton_box_new ();
  gtk_container_add (GTK_CONTAINER (control_window), vbbox);

  button = gtk_button_new_with_mnemonic ("_Select all");
  gtk_container_add (GTK_CONTAINER (vbbox), button);
  g_signal_connect_swapped (button, "clicked",
			    G_CALLBACK (gtk_file_chooser_select_all), dialog);
  
  button = gtk_button_new_with_mnemonic ("_Unselect all");
  gtk_container_add (GTK_CONTAINER (vbbox), button);
  g_signal_connect_swapped (button, "clicked",
			    G_CALLBACK (gtk_file_chooser_unselect_all), dialog);

  gtk_widget_show_all (control_window);
  
  gtk_main ();

  return 0;
}
void addressbook_edit_person_page_attrib_ldap(PersonEditDlg *dialog, gint pageNum, gchar *pageLbl) {
	GtkWidget *combo_box;
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *vboxl;
	GtkWidget *vboxb;
	GtkWidget *vbuttonbox;
	GtkWidget *buttonDel;
	GtkWidget *buttonMod;
	GtkWidget *buttonAdd;

	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *clist_swin;
	GtkWidget *clist;
	GtkWidget *entry_value;
	gint top;

	personEditDlg = dialog;

	gchar *titles[ATTRIB_N_COLS];
	gint i;

	titles[ATTRIB_COL_NAME] = N_("Name");
	titles[ATTRIB_COL_VALUE] = N_("Value");

	vbox = gtk_vbox_new(FALSE, 8);
	gtk_widget_show(vbox);
	gtk_container_add(GTK_CONTAINER(personEditDlg->notebook), vbox);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH);

	label = gtk_label_new_with_mnemonic(pageLbl);
	gtk_widget_show(label);
	gtk_notebook_set_tab_label(
		GTK_NOTEBOOK(personEditDlg->notebook),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(personEditDlg->notebook), pageNum), label);

	/* Split into two areas */
	hbox = gtk_hbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(vbox), hbox);

	/* Attribute list */
	vboxl = gtk_vbox_new(FALSE, 4);
	gtk_container_add(GTK_CONTAINER(hbox), vboxl);
	gtk_container_set_border_width(GTK_CONTAINER(vboxl), 4);

	clist_swin = gtk_scrolled_window_new(NULL, NULL);
	gtk_container_add(GTK_CONTAINER(vboxl), clist_swin);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin),
				       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	clist = gtk_cmclist_new_with_titles(ATTRIB_N_COLS, titles);
	gtk_container_add(GTK_CONTAINER(clist_swin), clist);
	gtk_cmclist_set_selection_mode(GTK_CMCLIST(clist), GTK_SELECTION_BROWSE);
	gtk_cmclist_set_column_width(GTK_CMCLIST(clist), ATTRIB_COL_NAME, ATTRIB_COL_WIDTH_NAME);
	gtk_cmclist_set_column_width(GTK_CMCLIST(clist), ATTRIB_COL_VALUE, ATTRIB_COL_WIDTH_VALUE);
	gtk_cmclist_set_compare_func(GTK_CMCLIST(clist), edit_person_attrib_compare_func);
	gtk_cmclist_set_auto_sort(GTK_CMCLIST(clist), TRUE);

	for (i = 0; i < ATTRIB_N_COLS; i++)
		gtkut_widget_set_can_focus(GTK_CMCLIST(clist)->column[i].button, FALSE);

	/* Data entry area */
	table = gtk_table_new(4, 2, FALSE);
	gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(table), 4);
	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
	gtk_table_set_col_spacings(GTK_TABLE(table), 4);

	/* First row */
	top = 0;
	label = gtk_label_new(N_("Name"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	gchar **attribute = (gchar **) ATTRIBUTE;

	combo_box = gtk_combo_box_new_text();

	while (*attribute) {
		if (!strcmp(*attribute, "jpegPhoto")) {
			attribute++;
			continue;
		}
		gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), *attribute++);
	}
	gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);

	gtk_table_attach(GTK_TABLE(table), combo_box, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	/* Next row */
	++top;
	label = gtk_label_new(N_("Value"));
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	entry_value = gtk_entry_new();
	gtk_table_attach(GTK_TABLE(table), entry_value, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);

	/* Button box */
	vboxb = gtk_vbox_new(FALSE, 4);
	gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2);

	vbuttonbox = gtk_vbutton_box_new();
	gtk_button_box_set_layout(GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START);
	gtk_box_set_spacing(GTK_BOX(vbuttonbox), 8);
	gtk_container_set_border_width(GTK_CONTAINER(vbuttonbox), 4);
	gtk_container_add(GTK_CONTAINER(vboxb), vbuttonbox);

	/* Buttons */
	buttonDel = gtk_button_new_from_stock(GTK_STOCK_DELETE);
	gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonDel);

	buttonMod = gtk_button_new_from_stock(GTK_STOCK_SAVE);
	gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonMod);

	buttonAdd = gtk_button_new_from_stock(GTK_STOCK_ADD);
	gtk_container_add(GTK_CONTAINER(vbuttonbox), buttonAdd);
	
	gtk_widget_set_sensitive(buttonDel,FALSE);
	gtk_widget_set_sensitive(buttonMod,FALSE);
	gtk_widget_set_sensitive(buttonAdd,FALSE);

	gtk_widget_show_all(vbox);
	
	/* Event handlers */
	g_signal_connect(G_OBJECT(clist), "select_row",
			  G_CALLBACK( edit_person_attrib_list_selected), NULL);
	g_signal_connect(G_OBJECT(buttonDel), "clicked",
			  G_CALLBACK(edit_person_attrib_delete), NULL);
	g_signal_connect(G_OBJECT(buttonMod), "clicked",
			  G_CALLBACK(edit_person_attrib_modify), NULL);
	g_signal_connect(G_OBJECT(buttonAdd), "clicked",
			  G_CALLBACK(edit_person_attrib_add), NULL);
	g_signal_connect(G_OBJECT(combo_box), "changed",
			 G_CALLBACK(edit_person_entry_att_changed), NULL);
	g_signal_connect(G_OBJECT(entry_value), "key_press_event",
			 G_CALLBACK(edit_person_entry_att_pressed), NULL);
	g_signal_connect(G_OBJECT(combo_box), "changed",
			 G_CALLBACK(edit_person_combo_box_changed), clist);

	personEditDlg->clist_attrib  = clist;
	personEditDlg->entry_atname  = combo_box;
	personEditDlg->entry_atvalue = entry_value;
	personEditDlg->attrib_add = buttonAdd;
	personEditDlg->attrib_del = buttonDel;
	personEditDlg->attrib_mod = buttonMod;
}
Ejemplo n.º 22
0
int
main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *hbox, *vbox;
  GtkWidget *vbox2, *bbox;
  GtkWidget *button;
  GtkTreeViewColumn *column;
  GtkCellRenderer *cell;
  GtkWidget *swindow;
  GtkTreeModel *sample_model;
  gint i;

  gtk_init (&argc, &argv);

  /* First initialize all the models for signal purposes */
  left_tree_model = (GtkTreeModel *) gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
  sample_model = (GtkTreeModel *) gtk_list_store_new (1, G_TYPE_STRING);
  sample_tree_view_top = gtk_tree_view_new_with_model (sample_model);
  sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model);
  top_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_top));
  bottom_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_bottom));
  top_right_tree_view = gtk_tree_view_new_with_model (top_right_tree_model);
  bottom_right_tree_view = gtk_tree_view_new_with_model (bottom_right_tree_model);

  for (i = 0; i < 10; i++)
    {
      GtkTreeIter iter;
      gchar *string = g_strdup_printf ("%d", i);
      gtk_list_store_append (GTK_LIST_STORE (sample_model), &iter);
      gtk_list_store_set (GTK_LIST_STORE (sample_model), &iter, 0, string, -1);
      g_free (string);
    }

  /* Set up the test windows. */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); 
  gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
  gtk_window_set_title (GTK_WINDOW (window), "Top Window");
  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER (window), swindow);
  gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_top);
  gtk_widget_show_all (window);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); 
  gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
  gtk_window_set_title (GTK_WINDOW (window), "Bottom Window");
  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER (window), swindow);
  gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_bottom);
  gtk_widget_show_all (window);

  /* Set up the main window */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); 
  gtk_window_set_default_size (GTK_WINDOW (window), 500, 300);
  vbox = gtk_vbox_new (FALSE, 8);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  hbox = gtk_hbox_new (FALSE, 8);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);

  /* Left Pane */
  cell = gtk_cell_renderer_text_new ();

  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  left_tree_view = gtk_tree_view_new_with_model (left_tree_model);
  gtk_container_add (GTK_CONTAINER (swindow), left_tree_view);
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1,
					       "Unattached Columns", cell, "text", 0, NULL);
  cell = gtk_cell_renderer_toggle_new ();
  g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), left_tree_view);
  column = gtk_tree_view_column_new_with_attributes ("Visible", cell, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column);

  gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
  gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0);

  /* Middle Pane */
  vbox2 = gtk_vbox_new (FALSE, 8);
  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
  
  bbox = gtk_vbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
  gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0);

  button = gtk_button_new_with_mnemonic ("<< (_Q)");
  gtk_widget_set_sensitive (button, FALSE);
  g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view);
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)),
                    "changed", G_CALLBACK (selection_changed), button);
  gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);

  button = gtk_button_new_with_mnemonic (">> (_W)");
  gtk_widget_set_sensitive (button, FALSE);
  g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view);
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)),
                    "changed", G_CALLBACK (selection_changed), button);
  gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);

  bbox = gtk_vbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
  gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0);

  button = gtk_button_new_with_mnemonic ("<< (_E)");
  gtk_widget_set_sensitive (button, FALSE);
  g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view);
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)),
                    "changed", G_CALLBACK (selection_changed), button);
  gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);

  button = gtk_button_new_with_mnemonic (">> (_R)");
  gtk_widget_set_sensitive (button, FALSE);
  g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view);
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)),
                    "changed", G_CALLBACK (selection_changed), button);
  gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);

  
  /* Right Pane */
  vbox2 = gtk_vbox_new (FALSE, 8);
  gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);

  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (top_right_tree_view), FALSE);
  cell = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (top_right_tree_view), -1,
					       NULL, cell, "text", 0, NULL);
  cell = gtk_cell_renderer_toggle_new ();
  g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), top_right_tree_view);
  column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL);
  gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column);

  gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view);
  gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0);

  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (bottom_right_tree_view), FALSE);
  cell = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (bottom_right_tree_view), -1,
					       NULL, cell, "text", 0, NULL);
  cell = gtk_cell_renderer_toggle_new ();
  g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), bottom_right_tree_view);
  column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL);
  gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column);
  gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view);
  gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0);

  
  /* Drag and Drop */
  gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (left_tree_view),
					  GDK_BUTTON1_MASK,
					  row_targets,
					  G_N_ELEMENTS (row_targets),
					  GDK_ACTION_MOVE);
  gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (left_tree_view),
					row_targets,
					G_N_ELEMENTS (row_targets),
					GDK_ACTION_MOVE);

  gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (top_right_tree_view),
					  GDK_BUTTON1_MASK,
					  row_targets,
					  G_N_ELEMENTS (row_targets),
					  GDK_ACTION_MOVE);
  gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (top_right_tree_view),
					row_targets,
					G_N_ELEMENTS (row_targets),
					GDK_ACTION_MOVE);

  gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (bottom_right_tree_view),
					  GDK_BUTTON1_MASK,
					  row_targets,
					  G_N_ELEMENTS (row_targets),
					  GDK_ACTION_MOVE);
  gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (bottom_right_tree_view),
					row_targets,
					G_N_ELEMENTS (row_targets),
					GDK_ACTION_MOVE);


  gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);

  hbox = gtk_hbox_new (FALSE, 8);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  button = gtk_button_new_with_mnemonic ("_Add new Column");
  g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);

  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}
Ejemplo n.º 23
0
void FLAC_XMMS__configure(void)
{
	GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
	GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame;
	GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox;
	GtkWidget *resolution_replaygain_noise_shaping_vbox;
	GtkWidget *resolution_replaygain_bps_out_vbox;
	GtkWidget *label, *hbox;
	GtkWidget *bbox, *ok, *cancel;
	GList *list;

	GtkWidget *streaming_vbox;
	GtkWidget *streaming_buf_frame, *streaming_buf_hbox;
	GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin;
	GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin;
	GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
	GtkWidget *streaming_proxy_port_label, 	*streaming_proxy_host_label;
	GtkWidget *streaming_save_frame, *streaming_save_vbox;
	GtkWidget *streaming_save_label, *streaming_save_browse;
#ifdef FLAC_ICECAST
	GtkWidget *streaming_cast_frame, *streaming_cast_vbox;
#endif
	char *temp;

	if (flac_configurewin != NULL) {
		gdk_window_raise(flac_configurewin->window);
		return;
	}
	flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG);
	gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin);
	gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin);
	gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration"));
	gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE);
	gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10);

	vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox);

	notebook = gtk_notebook_new();
	gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

	/* Title config.. */

	title_frame = gtk_frame_new(_("Tag Handling"));
	gtk_container_border_width(GTK_CONTAINER(title_frame), 5);

	title_tag_vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
	gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);

	/* Convert Char Set */

	convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set);
	gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL);
	gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0);
	/*  Combo boxes... */
	hbox = gtk_hbox_new(FALSE,4);
	gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox);
	label = gtk_label_new(_("Convert character set from :"));
	gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
	fileCharacterSetEntry = gtk_combo_new();
	gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0);

	label = gtk_label_new (_("to :"));
	gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
	userCharacterSetEntry = gtk_combo_new();
	gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0);

	gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE);
	gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE);
	gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE);
	gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE);

	list = Charset_Create_List();
	gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),Charset_Create_List_UTF8_Only());
	gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list);
	gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set));
	gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE);
	gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);

	/* Override Tagging Format */

	title_tag_override = gtk_check_button_new_with_label(_("Override generic titles"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override);
	gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL);
	gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0);

	title_tag_box = gtk_hbox_new(FALSE, 5);
	gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
	gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0);

	title_tag_label = gtk_label_new(_("Title format:"));
	gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0);

	title_tag_entry = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format);
	gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0);

	title_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
	gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
	gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);

	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title")));

	/* Output config.. */

	output_vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(output_vbox), 5);

	/* replaygain */

	replaygain_frame = gtk_frame_new(_("ReplayGain"));
	gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5);
	gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0);

	replaygain_vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5);
	gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox);

	replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable);
	gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL);
	gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0);

	replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode);
	gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL);
	gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0);

	hbox = gtk_hbox_new(FALSE,3);
	gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox);
	label = gtk_label_new(_("Preamp:"));
	gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
	replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0);
	gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL);
	replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp));
	gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE);
	gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0);
	replaygain_preamp_label = gtk_label_new(_("0 dB"));
	gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0);
	gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp));

	replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit);
	gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL);
	gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0);

	replaygain_enable_cb(replaygain_enable, NULL);

	/* resolution */

	resolution_frame = gtk_frame_new(_("Resolution"));
	gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5);
	gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0);

	resolution_hbox = gtk_hbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5);
	gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox);

	resolution_normal_frame = gtk_frame_new(_("Without ReplayGain"));
	gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5);
	gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0);

	resolution_normal_vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5);
	gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox);

	resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16);
	gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL);
	gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0);

	resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain"));
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5);
	gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0);

	resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox);

	resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL);
	gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0);

	hbox = gtk_hbox_new(FALSE, 10);
	gtk_container_border_width(GTK_CONTAINER(hbox), 5);
	gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0);

	resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping"));
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5);
	gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0);

	resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new();
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox);

	resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none"));
	if(flac_cfg.output.resolution.replaygain.noise_shaping == 0)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none);

	resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low"));
	if(flac_cfg.output.resolution.replaygain.noise_shaping == 1)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low);

	resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium"));
	if(flac_cfg.output.resolution.replaygain.noise_shaping == 2)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium);

	resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high"));
	if(flac_cfg.output.resolution.replaygain.noise_shaping == 3)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high);

	resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to"));
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5);
	gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0);

	resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new();
	gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox);

	resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps"));
	if(flac_cfg.output.resolution.replaygain.bps_out == 16)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps);

	resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps"));
	if(flac_cfg.output.resolution.replaygain.bps_out == 24)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE);
	gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
	gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps);

	resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL);

	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output")));

	/* Streaming */

	streaming_vbox = gtk_vbox_new(FALSE, 0);

	streaming_buf_frame = gtk_frame_new(_("Buffering:"));
	gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5);
	gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, FALSE, 0);

	streaming_buf_hbox = gtk_hbox_new(TRUE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5);
	gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox);

	streaming_size_box = gtk_hbox_new(FALSE, 5);
	/*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */
	gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, TRUE, TRUE, 0);
	streaming_size_label = gtk_label_new(_("Buffer size (kb):"));
	gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0);
	streaming_size_adj = gtk_adjustment_new(flac_cfg.stream.http_buffer_size, 4, 4096, 4, 4, 4);
	streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0);
	gtk_widget_set_usize(streaming_size_spin, 60, -1);
	gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, FALSE, FALSE, 0);

	streaming_pre_box = gtk_hbox_new(FALSE, 5);
	/*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */
	gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, TRUE, TRUE, 0);
	streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
	gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0);
	streaming_pre_adj = gtk_adjustment_new(flac_cfg.stream.http_prebuffer, 0, 90, 1, 1, 1);
	streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0);
	gtk_widget_set_usize(streaming_pre_spin, 60, -1);
	gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, FALSE, FALSE, 0);

 	/*
 	 * Proxy config.
 	 */
	streaming_proxy_frame = gtk_frame_new(_("Proxy:"));
	gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5);
	gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame, FALSE, FALSE, 0);

	streaming_proxy_vbox = gtk_vbox_new(FALSE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5);
	gtk_container_add(GTK_CONTAINER(streaming_proxy_frame), streaming_proxy_vbox);

	streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use), flac_cfg.stream.use_proxy);
	gtk_signal_connect(GTK_OBJECT(streaming_proxy_use), "clicked", GTK_SIGNAL_FUNC(proxy_use_cb), NULL);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use, FALSE, FALSE, 0);

	streaming_proxy_hbox = gtk_hbox_new(FALSE, 5);
	gtk_widget_set_sensitive(streaming_proxy_hbox, flac_cfg.stream.use_proxy);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox, FALSE, FALSE, 0);

	streaming_proxy_host_label = gtk_label_new(_("Host:"));
	gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0);

	streaming_proxy_host_entry = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0);

	streaming_proxy_port_label = gtk_label_new(_("Port:"));
	gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_label, FALSE, FALSE, 0);

	streaming_proxy_port_entry = gtk_entry_new();
	gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1);
	temp = g_strdup_printf("%d", flac_cfg.stream.proxy_port);
	gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp);
	g_free(temp);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_entry, FALSE, FALSE, 0);

	streaming_proxy_auth_use = gtk_check_button_new_with_label(_("Use authentication"));
	gtk_widget_set_sensitive(streaming_proxy_auth_use, flac_cfg.stream.use_proxy);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use), flac_cfg.stream.proxy_use_auth);
	gtk_signal_connect(GTK_OBJECT(streaming_proxy_auth_use), "clicked", GTK_SIGNAL_FUNC(proxy_auth_use_cb), NULL);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_use, FALSE, FALSE, 0);

	streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5);
	gtk_widget_set_sensitive(streaming_proxy_auth_hbox, flac_cfg.stream.use_proxy && flac_cfg.stream.proxy_use_auth);
	gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_hbox, FALSE, FALSE, 0);

	streaming_proxy_auth_user_label = gtk_label_new(_("Username:"******"Password:"******"Save stream to disk:"));
	gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5);
	gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, FALSE, FALSE, 0);

	streaming_save_vbox = gtk_vbox_new(FALSE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5);
	gtk_container_add(GTK_CONTAINER(streaming_save_frame), streaming_save_vbox);

	streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), flac_cfg.stream.save_http_stream);
	gtk_signal_connect(GTK_OBJECT(streaming_save_use), "clicked", GTK_SIGNAL_FUNC(streaming_save_use_cb), NULL);
	gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, FALSE, FALSE, 0);

	streaming_save_hbox = gtk_hbox_new(FALSE, 5);
	gtk_widget_set_sensitive(streaming_save_hbox, flac_cfg.stream.save_http_stream);
	gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0);

	streaming_save_label = gtk_label_new(_("Path:"));
	gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0);

	streaming_save_entry = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path);
	gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0);

	streaming_save_browse = gtk_button_new_with_label(_("Browse"));
	gtk_signal_connect(GTK_OBJECT(streaming_save_browse), "clicked", GTK_SIGNAL_FUNC(streaming_save_browse_cb), NULL);
	gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, FALSE, FALSE, 0);

#ifdef FLAC_ICECAST
	streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:"));
	gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5);
	gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, FALSE, FALSE, 0);

	streaming_cast_vbox = gtk_vbox_new(5, FALSE);
	gtk_container_add(GTK_CONTAINER(streaming_cast_frame), streaming_cast_vbox);

	streaming_cast_title = gtk_check_button_new_with_label(_("Enable SHOUT/Icecast title streaming"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_cast_title), flac_cfg.stream.cast_title_streaming);
	gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title, FALSE, FALSE, 0);

	streaming_udp_title = gtk_check_button_new_with_label(_("Enable Icecast Metadata UDP Channel"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), flac_cfg.stream.use_udp_channel);
	gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0);
#endif

	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, gtk_label_new(_("Streaming")));

	/* Buttons */

	bbox = gtk_hbutton_box_new();
	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
	gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
	gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);

	ok = gtk_button_new_with_label(_("Ok"));
	gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL);
	GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
	gtk_widget_grab_default(ok);

	cancel = gtk_button_new_with_label(_("Cancel"));
	gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin));
	GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);

	gtk_widget_show_all(flac_configurewin);
}
Ejemplo n.º 24
0
int main( int argc,char *argv[])
{
    
    /* GtkWidget es el tipo de almancenamiento para los widgets */
    GtkWidget *window;   
    GtkWidget *title;
    GtkWidget *option1;
    GtkWidget *option2;
    GtkWidget *box;
    
    /* Esto se llama en todas las aplicaciones del GTK. Los argumentos se leen 
     * de la linea de comandos y son filtrados y devueltos a la aplicación.
     */
    gtk_init (&argc, &argv);

    /* Crea una nueva ventana */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    
    /* Crea una caja con botones */
    box = gtk_vbutton_box_new ();

    /* Esto empaqueta la caja en la ventana (un contenedor gtk) */
    gtk_container_add (GTK_CONTAINER (window), box);
    
    /* Crear una nueva etiqueta */
    title = gtk_label_new ("BIENVENIDO A AGENDA ELECTRONICA\n");
    
    gtk_misc_set_alignment (GTK_MISC (title), 0.5, 0);

    /* Empaqueta el título en la caja */
    gtk_box_pack_start (GTK_BOX(box), title, FALSE, FALSE, 0);

    /* Mostrar el título */
    gtk_widget_show (title);
    
    gtk_widget_set_usize (GTK_WIDGET (window), 400, 300);
    gtk_window_set_title (GTK_WINDOW (window), "Agenda Electronica");
  
    /* Define la anchura del borde de la ventana.  */
    gtk_container_border_width (GTK_CONTAINER (window), 60);

    /* Crea cuatro ventanas para las etiquetas */
    option1 = gtk_button_new_with_label ("Acceder a la agenda de usuario.");
    option2 = gtk_button_new_with_label ("Salir de la aplicacion.");
    
    /* Esto empaqueta los cuatro botones en la caja (un contenedor gtk) */
    gtk_container_add (GTK_CONTAINER (box), option1);
    gtk_container_add (GTK_CONTAINER (box), option2);
    
    /* Aquí se conecta el evento "destroy" a un manejador de señal.
     * Este evento se produce cuando se llama a gtk_widget_destroy() en la ventana */
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
		    	GTK_SIGNAL_FUNC(closeAppWindow), NULL);

    /* Conecta el evento "clicked" al manejador de evento clickButton1 */
    gtk_signal_connect (GTK_OBJECT (option1), "clicked",
		    	GTK_SIGNAL_FUNC(clickButton1), NULL);

    /* Conecta el evento "clicked" al manejador de evento clickButton2 */
    gtk_signal_connect (GTK_OBJECT (option2), "clicked",
		    	GTK_SIGNAL_FUNC(clickButton2), NULL);

    /* Muestra los botones */
    gtk_widget_show (option1);
    gtk_widget_show (option2);

    /* y la caja */
    gtk_widget_show (box);

  
    gtk_widget_set_uposition( window, 400, 200 );
    
    /* y la ventana */
    gtk_widget_show (window);

    /* Todas las aplicaciones GTK deben tener un gtk_main(). El control termina 
     * aquí y espera a que ocurran eventos (como una pulsación de tecla o ratón)
     */
    gtk_main ();

    return(0);
}
Ejemplo n.º 25
0
static void create_bus_layout_dialog (bus_layout_D *dialog)
  {
  GtkWidget *tblMain = NULL, *frm = NULL, *img = NULL, *tbl = NULL, *align = NULL, *bbox = NULL ;

  dialog->dialog = gtk_dialog_new () ;
  gtk_window_set_title (GTK_WINDOW (dialog->dialog), _("Bus Layout")) ;
  gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), TRUE) ;
  gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 200) ;

  tblMain = gtk_table_new (1, 2, FALSE) ;
  gtk_widget_show (tblMain) ;
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox), tblMain, TRUE, TRUE, 0) ;
  gtk_container_set_border_width (GTK_CONTAINER (tblMain), 2) ;

  frm = gtk_frame_new (_("Cells And Buses")) ;
  gtk_widget_show (frm) ;
  gtk_table_attach (GTK_TABLE (tblMain), frm, 0, 1, 0, 1,
    (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
    (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 2, 2) ;
  gtk_container_set_border_width (GTK_CONTAINER (frm), 2) ;

  dialog->sw = gtk_scrolled_window_new (NULL, NULL) ;
  gtk_widget_show (dialog->sw) ;
  gtk_container_add (GTK_CONTAINER (frm), dialog->sw) ;
  gtk_container_set_border_width (GTK_CONTAINER (dialog->sw), 2) ;
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (dialog->sw), GTK_SHADOW_IN) ;
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) ;

  dialog->tview = create_bus_layout_tree_view (FALSE, NULL, GTK_SELECTION_MULTIPLE) ;
  gtk_widget_show (dialog->tview) ;
  gtk_container_add (GTK_CONTAINER (dialog->sw), dialog->tview) ;
  gtk_tree_selection_set_select_function (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tview)),
    (GtkTreeSelectionFunc)select_cell_row_p, NULL, NULL) ;

  align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0) ;
  gtk_widget_show (align) ;
  gtk_table_attach (GTK_TABLE (tblMain), align, 1, 2, 0, 1,
    (GtkAttachOptions)(GTK_FILL),
    (GtkAttachOptions)(GTK_FILL), 2, 2) ;
  gtk_container_set_border_width (GTK_CONTAINER (align), 2) ;

  tbl = gtk_table_new (3, 1, FALSE) ;
  gtk_widget_show (tbl) ;
  gtk_container_add (GTK_CONTAINER (align), tbl) ;
  gtk_container_set_border_width (GTK_CONTAINER (tbl), 2) ;

  bbox = gtk_vbutton_box_new () ;
  gtk_widget_show (bbox) ;
  gtk_table_attach (GTK_TABLE (tbl), bbox, 0, 1, 0, 1,
    (GtkAttachOptions)(0),
    (GtkAttachOptions)(0), 2, 2) ;
  gtk_container_set_border_width (GTK_CONTAINER (bbox), 2) ;
//  gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), gtk_vbutton_box_get_spacing_default ()) ;

  dialog->btnCreateBus = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON), _("Create Bus"), FALSE) ;
  gtk_widget_show (dialog->btnCreateBus) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnCreateBus, FALSE, TRUE, 0) ;

  dialog->btnDeleteBus = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON), _("Delete Bus"), FALSE) ;
  gtk_widget_show (dialog->btnDeleteBus) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnDeleteBus, FALSE, TRUE, 0) ;

  dialog->btnMoveBusUp = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON), _("Move Bus Up"), FALSE) ;
  gtk_widget_show (dialog->btnMoveBusUp) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnMoveBusUp, FALSE, TRUE, 0) ;

  dialog->btnMoveBusDown = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON), _("Move Bus Down"), FALSE) ;
  gtk_widget_show (dialog->btnMoveBusDown) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnMoveBusDown, FALSE, TRUE, 0) ;

  dialog->btnMoveCellsUp = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON), _("Make Cell(s) More Significant"), FALSE) ;
  gtk_widget_show (dialog->btnMoveCellsUp) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnMoveCellsUp, FALSE, TRUE, 0) ;

  dialog->btnMoveCellsDown = create_pixmap_button (img = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON), _("Make Cell(s) Less Significant"), FALSE) ;
  gtk_widget_show (dialog->btnMoveCellsDown) ;
  gtk_widget_show (img) ;
  gtk_box_pack_start (GTK_BOX (bbox), dialog->btnMoveCellsDown, FALSE, TRUE, 0) ;

  dialog->lblBusName = gtk_label_new (_("Bus Name:")) ;
  gtk_widget_show (dialog->lblBusName) ;
  gtk_table_attach (GTK_TABLE (tbl), dialog->lblBusName, 0, 1, 1, 2,
    (GtkAttachOptions)(GTK_FILL),
    (GtkAttachOptions)(0), 2, 2) ;
  gtk_label_set_justify (GTK_LABEL (dialog->lblBusName), GTK_JUSTIFY_LEFT) ;
  gtk_misc_set_alignment (GTK_MISC (dialog->lblBusName), 0.0, 1.0) ;

  dialog->txtBusName = g_object_new (GTK_TYPE_ENTRY, "text", _("Untitled Bus"), NULL) ;
  gtk_widget_show (dialog->txtBusName) ;
  gtk_table_attach (GTK_TABLE (tbl), dialog->txtBusName, 0, 1, 2, 3,
    (GtkAttachOptions)(GTK_FILL),
    (GtkAttachOptions)(0), 2, 2) ;

  gtk_dialog_add_button (GTK_DIALOG (dialog->dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL) ;
  gtk_dialog_add_button (GTK_DIALOG (dialog->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK) ;
  gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog), GTK_RESPONSE_OK) ;

  g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tview))), "changed", (GCallback)tree_view_selection_changed, dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnCreateBus),     "clicked",     (GCallback)create_bus_button_clicked, dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnDeleteBus),     "clicked",     (GCallback)delete_bus_button_clicked, dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnMoveCellsUp),   "clicked",     (GCallback)raise_bus_cell_position,   dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnMoveCellsDown), "clicked",     (GCallback)lower_bus_cell_position,   dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnMoveBusUp),     "clicked",     (GCallback)raise_bus_position,        dialog) ;
  g_signal_connect (G_OBJECT (dialog->btnMoveBusDown),   "clicked",     (GCallback)lower_bus_position,        dialog) ;
  g_signal_connect (G_OBJECT (dialog->txtBusName),       "changed",     (GCallback)bus_name_changed,          dialog) ;
  g_signal_connect (G_OBJECT (dialog->txtBusName),       "insert-text", (GCallback)entry_insert_text,         dialog) ;
  g_signal_connect (G_OBJECT (dialog->txtBusName),       "delete-text", (GCallback)entry_delete_text,         dialog) ;
  }
Ejemplo n.º 26
0
static void
asgtk_image_view_make_parts (ASGtkImageView * iv, Bool horizontal)
{
	iv->frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 1.0, TRUE);
	gtk_frame_set_shadow_type (GTK_FRAME (iv->frame), GTK_SHADOW_NONE);
	gtk_widget_show (iv->frame);
	colorize_gtk_widget (iv->frame, get_colorschemed_style_normal ());

	iv->scrolled_window =
			ASGTK_SCROLLED_WINDOW (GTK_POLICY_NEVER, GTK_POLICY_NEVER,
														 GTK_SHADOW_NONE);
	ASGTK_CONTAINER_ADD (iv->frame, iv->scrolled_window);

	if (!get_flags
			(iv->flags,
			 ASGTK_IMAGE_VIEW_SCALE_TO_VIEW | ASGTK_IMAGE_VIEW_TILE_TO_VIEW)) {
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
																		(iv->scrolled_window),
																		GTK_POLICY_AUTOMATIC,
																		GTK_POLICY_AUTOMATIC);
	}
	colorize_gtk_widget (GTK_WIDGET (iv->scrolled_window),
											 get_colorschemed_style_normal ());

	iv->view = gtk_image_new_from_pixbuf (NULL);
	gtk_widget_show (GTK_WIDGET (iv->view));
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW
																				 (iv->scrolled_window),
																				 GTK_WIDGET (iv->view));
	colorize_gtk_widget (GTK_WIDGET (iv->view),
											 get_colorschemed_style_normal ());

	g_signal_connect ((gpointer) iv->scrolled_window, "size-allocate",
										G_CALLBACK (asgtk_imview_view_size_alloc), iv);
	iv->details_label = gtk_label_new (NO_IMAGE_TEXT);
	gtk_widget_show (iv->details_label);

	iv->details_frame = gtk_frame_new (NULL);
	gtk_widget_show (iv->details_frame);
	gtk_container_set_border_width (GTK_CONTAINER (iv->details_frame), 1);
	gtk_frame_set_shadow_type (GTK_FRAME (iv->details_frame), GTK_SHADOW_IN);
	colorize_gtk_widget (iv->details_frame,
											 get_colorschemed_style_normal ());

	iv->tools_hbox =
			horizontal ? gtk_vbox_new (FALSE, 0) : gtk_hbutton_box_new ();
	gtk_container_set_border_width (GTK_CONTAINER (iv->tools_hbox), 0);
	if (GTK_IS_BUTTON_BOX (iv->tools_hbox))
		gtk_button_box_set_layout (GTK_BUTTON_BOX (iv->tools_hbox),
															 GTK_BUTTONBOX_END /*SPREAD*/);
	gtk_widget_show (iv->tools_hbox);

	iv->details_hbox =
			horizontal ? gtk_vbutton_box_new () : gtk_hbutton_box_new ();
	gtk_container_set_border_width (GTK_CONTAINER (iv->details_hbox), 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (iv->details_hbox),
														 GTK_BUTTONBOX_EDGE);
	gtk_widget_show (iv->details_hbox);

	gtk_container_add (GTK_CONTAINER (iv->details_frame), iv->details_hbox);
	gtk_box_pack_end (GTK_BOX (iv->details_hbox), iv->details_label, TRUE,
										TRUE, 0);

}
Ejemplo n.º 27
0
Archivo: gui.cpp Proyecto: dynbit/TFOS
void GUI::setup_left_box(){
	// create label
	GtkWidget * cpu_frame;
	cpu_frame = gtk_frame_new ("CPU");
	
	// create cpu box
	GtkWidget * cpu_box;
	cpu_box = gtk_vbox_new (FALSE, 0);

	/*	IC REGISTER */	
	// ic box
	GtkWidget * ic_box;
	ic_box = gtk_hbox_new (FALSE, 0);
	// ic label 
	GtkWidget * ic_label;
	ic_label = gtk_label_new ("IC");
	gtk_widget_set_usize (ic_label, 80, 28);
	// create ic
        this->ic_buffer = gtk_entry_buffer_new (NULL, -1);
	this->ic = gtk_entry_new_with_buffer (this->ic_buffer);
	gtk_entry_set_editable (GTK_ENTRY(this->ic), FALSE);
	gtk_widget_set_can_focus (this->ic, FALSE);
	// add content to ic_box
	gtk_box_pack_start (GTK_BOX (ic_box), ic_label, FALSE, FALSE, 20);
	gtk_box_pack_start (GTK_BOX (ic_box), this->ic, FALSE, FALSE, 5);
	
	/*	ST REGISTER */
	// st box 
	GtkWidget * st_box;
	st_box = gtk_hbox_new (FALSE, 0);
	// ic label 
	GtkWidget * st_label;
	st_label = gtk_label_new ("ST");
	gtk_widget_set_usize (st_label, 80, 28);
	// create ic
        this->st_buffer = gtk_entry_buffer_new (NULL, -1);
	this->st = gtk_entry_new_with_buffer (this->st_buffer);
	gtk_entry_set_editable (GTK_ENTRY(this->st), FALSE);
	gtk_widget_set_can_focus (this->st, FALSE);
	// add content to ic_box
	gtk_box_pack_start (GTK_BOX (st_box), st_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (st_box), this->st, FALSE, FALSE, 5);
	
	// add ic_box to cpu box
	gtk_box_pack_start (GTK_BOX (cpu_box), ic_box, FALSE, FALSE, 5);
	gtk_box_pack_end (GTK_BOX (cpu_box), st_box, FALSE, FALSE, 5);
	
	// put cpu_box in cpu_frame
	gtk_container_add (GTK_CONTAINER (cpu_frame), cpu_box);

	// left top box
	GtkWidget * left_top_box;
	left_top_box = gtk_hbox_new (FALSE, 5);
	gtk_box_pack_start (GTK_BOX (left_top_box), cpu_frame, FALSE, FALSE, 0);
	this->left_box = gtk_vbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (this->left_box), left_top_box, FALSE, FALSE, 0);


        // CHANNELS

        // channels frame
	GtkWidget * channels_frame;
	channels_frame = gtk_frame_new ("CHANNELS");

        GtkWidget * channels_vbox;
        channels_vbox = gtk_vbox_new (FALSE, 5);


        // keyboard
        GtkWidget * kb_box;
	kb_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * kb_label;
	kb_label = gtk_label_new ("KEYBOARD");
        gtk_widget_set_usize (kb_label, 80, 28);
        this->keyboard_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->keyboard_channel), FALSE);
	gtk_widget_set_can_focus (this->keyboard_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (kb_box), kb_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (kb_box), this->keyboard_channel, FALSE, FALSE, 5);

        gtk_box_pack_start (GTK_BOX (channels_vbox ), kb_box, FALSE, FALSE, 0);


        // monitor
        GtkWidget * mn_box;
	mn_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * mn_label;
	mn_label = gtk_label_new ("MONITOR");
        gtk_widget_set_usize (mn_label, 80, 28);
        this->monitor_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->monitor_channel), FALSE);
	gtk_widget_set_can_focus (this->monitor_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (mn_box), mn_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (mn_box), this->monitor_channel, FALSE, FALSE, 5);
        gtk_box_pack_start (GTK_BOX (channels_vbox), mn_box, FALSE, FALSE, 0);

        // hdd
        GtkWidget * hdd_box;
	hdd_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * hdd_label;
	hdd_label = gtk_label_new ("HDD");
        gtk_widget_set_usize (hdd_label, 80, 28);
        this->hdd_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->hdd_channel), FALSE);
	gtk_widget_set_can_focus (this->hdd_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (hdd_box), hdd_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (hdd_box), this->hdd_channel, FALSE, FALSE, 5);
        gtk_box_pack_start (GTK_BOX (channels_vbox), hdd_box, FALSE, FALSE, 0);


        gtk_container_add (GTK_CONTAINER (channels_frame), channels_vbox);
        gtk_box_pack_start (GTK_BOX (this->left_box), channels_frame, FALSE, FALSE, 0);
        
        GtkWidget * control_buttons;
        control_buttons = gtk_vbutton_box_new ();

        this->rm_mem_show_button = gtk_button_new_with_label("Show RM memory");
        g_signal_connect (this->rm_mem_show_button, "clicked", G_CALLBACK (GUI::rm_mem_show_button_clicked), gpointer(this));

        gtk_box_pack_start (GTK_BOX (control_buttons), this->rm_mem_show_button, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (this->left_box), control_buttons, FALSE, FALSE, 0);

}
Ejemplo n.º 28
0
void prefs_dialog_open(SensorsApplet *sensors_applet) {
        gchar *header_text;
        PrefsDialog *prefs_dialog;
        DisplayMode display_mode;

        g_assert(sensors_applet->prefs_dialog == NULL);

        /* while prefs dialog is open, stop the updating of sensors so
         * we don't get any race conditions due to concurrent updates
         * of the labels, values and icons linked lists etc. */
        if (sensors_applet->timeout_id != 0) {
                if (g_source_remove(sensors_applet->timeout_id)) {
                        sensors_applet->timeout_id = 0;
                }
        }

        sensors_applet->prefs_dialog = g_new0(PrefsDialog, 1);
        prefs_dialog = sensors_applet->prefs_dialog;

        prefs_dialog->sensors_applet = sensors_applet;

        prefs_dialog->dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Sensors Applet Preferences"),
                                                                      NULL,
                                                                      GTK_DIALOG_MODAL,
                                                                      GTK_STOCK_HELP,
                                                                      GTK_RESPONSE_HELP,
                                                                      GTK_STOCK_CLOSE,
                                                                      GTK_RESPONSE_CLOSE,
                                                                      NULL));
        g_object_set(prefs_dialog->dialog,
                     "border-width", 12,
                     "default-width", 480,
                     "default-height", 350,
                     NULL);

        gtk_box_set_homogeneous(GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), FALSE);

        gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), 5);


        g_signal_connect(prefs_dialog->dialog,
                         "response", G_CALLBACK(prefs_dialog_response),
                         sensors_applet);

        g_signal_connect_swapped(prefs_dialog->dialog,
                                 "delete-event", G_CALLBACK(prefs_dialog_close),
                                 sensors_applet);

        g_signal_connect_swapped(prefs_dialog->dialog,
                                 "destroy", G_CALLBACK(prefs_dialog_close),
                                 sensors_applet);

        /* if no SensorsList's have been created, this is because
           we haven't been able to access any sensors */
        if (sensors_applet->sensors == NULL) {
                GtkWidget *label;
                label = gtk_label_new(_("No sensors found!"));
                gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), label, TRUE, TRUE, 0);
                return;
        }


        header_text = g_markup_printf_escaped("<b>%s</b>", _("Display"));
        prefs_dialog->display_header = g_object_new(GTK_TYPE_LABEL,
                                                    "use-markup", TRUE,
                                                    "label", header_text,

                                                    "xalign", 0.0,
                                                    NULL);
        g_free(header_text);

        prefs_dialog->display_mode_combo_box = GTK_COMBO_BOX(gtk_combo_box_text_new());


        gtk_combo_box_text_append_text(prefs_dialog->display_mode_combo_box, _("label with value"));
        gtk_combo_box_text_append_text(prefs_dialog->display_mode_combo_box, _("icon with value"));
        gtk_combo_box_text_append_text(prefs_dialog->display_mode_combo_box, _("value only"));
        gtk_combo_box_text_append_text(prefs_dialog->display_mode_combo_box, _("icon only"));
        gtk_combo_box_text_append_text(prefs_dialog->display_mode_combo_box, _("graph only"));


        display_mode = g_settings_get_int(sensors_applet->settings, DISPLAY_MODE);
        gtk_combo_box_set_active(prefs_dialog->display_mode_combo_box, display_mode);

        g_signal_connect(prefs_dialog->display_mode_combo_box,
                         "changed",
                         G_CALLBACK(prefs_dialog_display_mode_changed),
                         prefs_dialog);



        /* use spaces in label to indent */
        prefs_dialog->display_mode_label = g_object_new(GTK_TYPE_LABEL,
                                                        "use-underline", TRUE,
                                                        "label", _("_Display sensors in panel as"),
                                                        "mnemonic-widget", prefs_dialog->display_mode_combo_box,
                                                        "xalign", 0.0,
                                                        NULL);




        prefs_dialog->layout_mode_combo_box = GTK_COMBO_BOX(gtk_combo_box_text_new());

        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->layout_mode_combo_box),
                                 (display_mode != DISPLAY_ICON) &&
                                 (display_mode != DISPLAY_VALUE) &&
                                 (display_mode != DISPLAY_GRAPH));

        gtk_combo_box_text_append_text(prefs_dialog->layout_mode_combo_box, _("beside labels / icons"));
        gtk_combo_box_text_append_text(prefs_dialog->layout_mode_combo_box, _("below labels / icons"));

        gtk_combo_box_set_active(prefs_dialog->layout_mode_combo_box, g_settings_get_int(sensors_applet->settings, LAYOUT_MODE));

        g_signal_connect(prefs_dialog->layout_mode_combo_box,
                         "changed",
                         G_CALLBACK(prefs_dialog_layout_mode_changed),
                         prefs_dialog);

        prefs_dialog->layout_mode_label = g_object_new(GTK_TYPE_LABEL,
                                                       "use-underline", TRUE,
                                                       "label", _("Preferred _position of sensor values"),
                                                       "mnemonic-widget", prefs_dialog->layout_mode_combo_box,
                                                       "xalign", 0.0,
                                                       NULL);

        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->layout_mode_label),
                                 (display_mode != DISPLAY_ICON) &&
                                 (display_mode != DISPLAY_VALUE) &&
                                 (display_mode != DISPLAY_GRAPH));

        prefs_dialog->temperature_scale_combo_box = GTK_COMBO_BOX(gtk_combo_box_text_new());

        gtk_combo_box_text_append_text(prefs_dialog->temperature_scale_combo_box, _("Kelvin"));
        gtk_combo_box_text_append_text(prefs_dialog->temperature_scale_combo_box, _("Celsius"));
        gtk_combo_box_text_append_text(prefs_dialog->temperature_scale_combo_box, _("Fahrenheit"));

        gtk_combo_box_set_active(prefs_dialog->temperature_scale_combo_box, g_settings_get_int(sensors_applet->settings, TEMPERATURE_SCALE));

        g_signal_connect(prefs_dialog->temperature_scale_combo_box,
                         "changed",
                         G_CALLBACK(prefs_dialog_temperature_scale_changed),
                         prefs_dialog);

        prefs_dialog->temperature_scale_label = g_object_new(GTK_TYPE_LABEL,
                                                             "use-underline", TRUE,
                                                             "label", _("_Temperature scale"),
                                                             "mnemonic-widget", prefs_dialog->temperature_scale_combo_box,
                                                             "xalign", 0.0,
                                                             NULL);

        prefs_dialog->graph_size_adjust = g_object_new(GTK_TYPE_ADJUSTMENT,
                                                       "value", (gdouble)g_settings_get_int(sensors_applet->settings, GRAPH_SIZE),
                                                       "lower", 1.0,
                                                       "upper", 100.0,
                                                       "step-increment", 1.0,
                                                       "page-increment", 10.0,
                                                       "page-size", 0.0,
                                                       NULL);

        prefs_dialog->graph_size_spinbutton = g_object_new(GTK_TYPE_SPIN_BUTTON,
                                                           "adjustment", prefs_dialog->graph_size_adjust,
                                                           "climb-rate", 1.0,
                                                           "digits", 0,
                                                           "value", (gdouble)g_settings_get_int(sensors_applet->settings, GRAPH_SIZE),
                                                           "width-chars", 4,
                                                           NULL);

        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->graph_size_spinbutton),
                                 (display_mode == DISPLAY_GRAPH));

        prefs_dialog->graph_size_label = g_object_new(GTK_TYPE_LABEL,
                                                      "use-underline", TRUE,
                                                      "label", _("Graph _size (pixels)"),
                                                      "mnemonic-widget", prefs_dialog->graph_size_spinbutton,
                                                      "xalign", 0.0,
                                                      NULL);

        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->graph_size_label),
                                 (display_mode == DISPLAY_GRAPH));

        g_signal_connect(prefs_dialog->graph_size_spinbutton, "value-changed",
                         G_CALLBACK(prefs_dialog_graph_size_changed),
                         prefs_dialog);


        header_text = g_markup_printf_escaped("<b>%s</b>", _("Update"));
        prefs_dialog->update_header = g_object_new(GTK_TYPE_LABEL,
                                                   "use-markup", TRUE,
                                                   "label", header_text,

                                                   "xalign", 0.0,
                                                   NULL);
        g_free(header_text);


        prefs_dialog->timeout_adjust = g_object_new(GTK_TYPE_ADJUSTMENT,
                                                    "value", 2.0,
                                                    "lower", 1.5,
                                                    "upper", 10.0,
                                                    "step-increment", 0.5,
                                                    "page-increment", 1.0,
                                                    "page-size", 0.0,
                                                    NULL);

        prefs_dialog->timeout_spinbutton = g_object_new(GTK_TYPE_SPIN_BUTTON,
                                                        "adjustment", prefs_dialog->timeout_adjust,
                                                        "climb-rate", 0.5,
                                                        "digits", 1,
                                                        "value", (gdouble) g_settings_get_int(sensors_applet->settings, TIMEOUT) / 1000.0,
                                                        "width-chars", 4,
                                                        NULL);


        prefs_dialog->timeout_label = g_object_new(GTK_TYPE_LABEL,
                                                   "use-underline", TRUE,
                                                   "label", _("Update _interval (secs)"),
                                                   "mnemonic-widget", prefs_dialog->timeout_spinbutton,
                                                   "xalign", 0.0,
                                                   NULL);

        g_signal_connect(prefs_dialog->timeout_spinbutton, "value-changed",
                         G_CALLBACK(prefs_dialog_timeout_changed),
                         prefs_dialog);

#ifdef HAVE_LIBNOTIFY
        header_text = g_markup_printf_escaped("<b>%s</b>", _("Notifications"));
        prefs_dialog->notifications_header = g_object_new(GTK_TYPE_LABEL,
                                                          "use-markup", TRUE,
                                                          "label", header_text,

                                                          "xalign", 0.0,
                                                          NULL);
        g_free(header_text);

        prefs_dialog->display_notifications = g_object_new(GTK_TYPE_CHECK_BUTTON,
                                                           "use-underline", TRUE,
                                                           "label", _("Display _notifications"),
                                                           NULL);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_dialog->display_notifications),
                                     g_settings_get_boolean(sensors_applet->settings,
                                                            DISPLAY_NOTIFICATIONS));
        g_signal_connect(prefs_dialog->display_notifications,
                         "toggled",
                         G_CALLBACK(prefs_dialog_display_notifications_toggled),
                         prefs_dialog);
#endif

        /* SIZE AND LAYOUT */
        /* keep all widgets same size */
        prefs_dialog->size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

        gtk_size_group_add_widget(prefs_dialog->size_group,
                                  GTK_WIDGET(prefs_dialog->display_mode_combo_box));

        gtk_size_group_add_widget(prefs_dialog->size_group,
                                  GTK_WIDGET(prefs_dialog->layout_mode_combo_box));

        gtk_size_group_add_widget(prefs_dialog->size_group,
                                  GTK_WIDGET(prefs_dialog->temperature_scale_combo_box));

        gtk_size_group_add_widget(prefs_dialog->size_group,
                                  GTK_WIDGET(prefs_dialog->timeout_spinbutton));

        g_object_unref(prefs_dialog->size_group);

        prefs_dialog->globals_table = g_object_new(GTK_TYPE_TABLE,
                                                   "homogeneous", FALSE,
                                                   "n-columns", 3,
#ifdef HAVE_LIBNOTIFY
                                                   "n-rows", 9,
#else
                                                   "n-rows", 7,
#endif
                                                   "row-spacing", 6,
                                                   "column-spacing", 12,
                                                   NULL);


        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->display_header),
                         0, 2,
                         0, 1,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->display_mode_label),
                         1, 2,
                         1, 2,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->display_mode_combo_box),
                         2, 3,
                         1, 2,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);


        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->layout_mode_label),
                         1, 2,
                         2, 3,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);
        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->layout_mode_combo_box),
                         2, 3,
                         2, 3,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);



        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->graph_size_label),
                         1, 2,
                         3, 4,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->graph_size_spinbutton),
                         2, 3,
                         3, 4,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->temperature_scale_label),
                         1, 2,
                         4, 5,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);
        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->temperature_scale_combo_box),
                         2, 3,
                         4, 5,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->update_header),
                         0, 2,
                         5, 6,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->timeout_label),
                         1, 2,
                         6, 7,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->timeout_spinbutton),
                         2, 3,
                         6, 7,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);


#ifdef HAVE_LIBNOTIFY
        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->notifications_header),
                         0, 2,
                         7, 8,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);

        gtk_table_attach(prefs_dialog->globals_table,
                         GTK_WIDGET(prefs_dialog->display_notifications),
                         1, 2,
                         8, 9,
                         GTK_FILL,
                         GTK_FILL,
                         0,
                         0);
#endif


        prefs_dialog->view = g_object_new(GTK_TYPE_TREE_VIEW,
                                          "model", GTK_TREE_MODEL(sensors_applet->sensors),
                                          "rules-hint", TRUE,
                                          "reorderable", FALSE,
                                          "enable-search", TRUE,
                                          "search-column", LABEL_COLUMN,
                                          NULL);

        /* get double clicks on rows - do same as configure sensor
         * button clicks */
        g_signal_connect(prefs_dialog->view, "row-activated",
                         G_CALLBACK(prefs_dialog_row_activated),
                         prefs_dialog);

        prefs_dialog->id_renderer = gtk_cell_renderer_text_new();
        prefs_dialog->label_renderer = gtk_cell_renderer_text_new();
        g_object_set(prefs_dialog->label_renderer,
                     "editable", TRUE,
                     NULL);

        g_signal_connect(prefs_dialog->label_renderer, "edited",
                         G_CALLBACK(prefs_dialog_sensor_name_changed),
                         prefs_dialog);

        prefs_dialog->enable_renderer = gtk_cell_renderer_toggle_new();
        g_signal_connect(prefs_dialog->enable_renderer, "toggled",
                         G_CALLBACK(prefs_dialog_sensor_toggled),
                         prefs_dialog);
        prefs_dialog->icon_renderer = gtk_cell_renderer_pixbuf_new();

        prefs_dialog->id_column = gtk_tree_view_column_new_with_attributes(_("Sensor"),
                                                                           prefs_dialog->id_renderer,
                                                                           "text", ID_COLUMN,
                                                                           NULL);

        gtk_tree_view_column_set_min_width(prefs_dialog->id_column, 90);

        prefs_dialog->label_column = gtk_tree_view_column_new_with_attributes(_("Label"),
                                                                              prefs_dialog->label_renderer,
                                                                              "text", LABEL_COLUMN,
                                                                              "visible", VISIBLE_COLUMN,
                                                                              NULL);

        gtk_tree_view_column_set_min_width(prefs_dialog->label_column, 100);

        /* create the tooltip */
        gtk_widget_set_tooltip_text(GTK_WIDGET(prefs_dialog->view),
                                    _("Labels can be edited directly by clicking on them."));
        prefs_dialog->enable_column = gtk_tree_view_column_new_with_attributes(_("Enabled"),
                                                                               prefs_dialog->enable_renderer,
                                                                               "active", ENABLE_COLUMN,
                                                                               "visible", VISIBLE_COLUMN,
                                                                               NULL);

        prefs_dialog->icon_column = gtk_tree_view_column_new_with_attributes(_("Icon"),
                                                                             prefs_dialog->icon_renderer,
                                                                             "pixbuf", ICON_PIXBUF_COLUMN,
                                                                             "visible", VISIBLE_COLUMN,
                                                                             NULL);
        gtk_tree_view_append_column(prefs_dialog->view,
                                    prefs_dialog->id_column);
        gtk_tree_view_append_column(prefs_dialog->view,
                                    prefs_dialog->icon_column);
        gtk_tree_view_append_column(prefs_dialog->view,
                                    prefs_dialog->label_column);
        gtk_tree_view_append_column(prefs_dialog->view,
                                    prefs_dialog->enable_column);

        gtk_tree_view_columns_autosize(prefs_dialog->view);

        prefs_dialog->scrolled_window = g_object_new(GTK_TYPE_SCROLLED_WINDOW,
                                                     "hadjustment", NULL,
                                                     "height-request", 200,
                                                     "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
                                                     "vadjustment",NULL,
                                                     "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
                                                     NULL);

        gtk_container_add(GTK_CONTAINER(prefs_dialog->scrolled_window), GTK_WIDGET(prefs_dialog->view));

        /* GtkTree Selection */
        sensors_applet->selection = gtk_tree_view_get_selection(prefs_dialog->view);
        /* allow user to only select one row at a time at most */
        gtk_tree_selection_set_mode(sensors_applet->selection, GTK_SELECTION_SINGLE);
        /* when selection is changed, make sure sensor_config button is
           activated */

        /* Create buttons for user to interact with sensors tree */
        prefs_dialog->sensor_up_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_GO_UP));
        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->sensor_up_button), FALSE);

        g_signal_connect(prefs_dialog->sensor_up_button, "clicked",
                         G_CALLBACK(prefs_dialog_sensor_up_button_clicked),
                         prefs_dialog);

        prefs_dialog->sensor_down_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_GO_DOWN));
        gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->sensor_down_button), FALSE);

        g_signal_connect(prefs_dialog->sensor_down_button, "clicked",
                         G_CALLBACK(prefs_dialog_sensor_down_button_clicked),
                         prefs_dialog);


        prefs_dialog->buttons_box = GTK_VBUTTON_BOX(gtk_vbutton_box_new());

        gtk_button_box_set_layout(GTK_BUTTON_BOX(prefs_dialog->buttons_box),
                                  GTK_BUTTONBOX_SPREAD);

        gtk_box_pack_start(GTK_BOX(prefs_dialog->buttons_box), GTK_WIDGET(prefs_dialog->sensor_up_button), FALSE, FALSE, 0);

        gtk_box_pack_start(GTK_BOX(prefs_dialog->buttons_box), GTK_WIDGET(prefs_dialog->sensor_down_button), FALSE, FALSE, 0);

        prefs_dialog->sensors_hbox = g_object_new(GTK_TYPE_HBOX,
                                                  "border-width", 5,
                                                  "homogeneous", FALSE,
                                                  "spacing", 5,
                                                  NULL);

        gtk_box_pack_start(prefs_dialog->sensors_hbox,
                           GTK_WIDGET(prefs_dialog->scrolled_window),
                           TRUE, TRUE, 0); /* make sure window takes
                                            * up most of room */

        gtk_box_pack_start(prefs_dialog->sensors_hbox,
                           GTK_WIDGET(prefs_dialog->buttons_box),
                           FALSE, FALSE, 0);


        /* Sensor Config button */
        /* initially make button insensitive until user selects a row
           from the sensors tree */
        prefs_dialog->sensor_config_button = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_PROPERTIES));
        g_object_set(prefs_dialog->sensor_config_button,
                     "sensitive", FALSE,
                     NULL);


        g_signal_connect(sensors_applet->selection,
                         "changed",
                         G_CALLBACK(prefs_dialog_selection_changed),
                         prefs_dialog);

        /* pass selection to signal handler so we can give user a
           sensors_applet->prefs_dialog with the selected rows alarm
           value and enable */
        g_signal_connect(prefs_dialog->sensor_config_button, "clicked",
                         G_CALLBACK(prefs_dialog_sensor_config_button_clicked),
                         prefs_dialog);

        prefs_dialog->sensor_config_hbox = g_object_new(GTK_TYPE_HBOX,
                                                        "border-width", 5,
                                                        "homogeneous", FALSE,
                                                        "spacing", 0,
                                                        NULL);
        gtk_box_pack_end(prefs_dialog->sensor_config_hbox,
                         GTK_WIDGET(prefs_dialog->sensor_config_button),
                         FALSE, FALSE, 0);

        /* pack sensors_vbox */
        prefs_dialog->sensors_vbox = g_object_new(GTK_TYPE_VBOX,
                                                  "border-width", 5,
                                                  "homogeneous", FALSE,
                                                  "spacing", 0,
                                                  NULL);

        gtk_box_pack_start(prefs_dialog->sensors_vbox,
                           GTK_WIDGET(prefs_dialog->sensors_hbox),
                           TRUE, TRUE, 0);
        gtk_box_pack_start(prefs_dialog->sensors_vbox,
                           GTK_WIDGET(prefs_dialog->sensor_config_hbox),
                           FALSE, FALSE, 0);

        prefs_dialog->globals_alignment = g_object_new(GTK_TYPE_ALIGNMENT,
                                                       "xalign", 0.5,
                                                       "yalign", 0.0,
                                                       "top-padding", 12,
                                                       "left-padding", 12,
                                                       "bottom-padding", 12,
                                                       "right-padding", 12,
                                                       NULL);
        gtk_container_add(GTK_CONTAINER(prefs_dialog->globals_alignment),
                          GTK_WIDGET(prefs_dialog->globals_table));

        prefs_dialog->notebook = g_object_new(GTK_TYPE_NOTEBOOK,
                                              NULL);

        gtk_notebook_append_page(prefs_dialog->notebook,
                                 GTK_WIDGET(prefs_dialog->globals_alignment),
                                 gtk_label_new(_("General Options")));

        gtk_notebook_append_page(prefs_dialog->notebook,
                                 GTK_WIDGET(prefs_dialog->sensors_vbox),
                                 gtk_label_new(_("Sensors")));

        /* pack notebook into prefs_dialog */
        gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)),
                            GTK_WIDGET(prefs_dialog->notebook), TRUE, TRUE, 0);


        gtk_widget_show_all(GTK_WIDGET(prefs_dialog->dialog));
}
Ejemplo n.º 29
0
void
create_configure_dialog(void)
{
	GtkWidget *config_dialog;
	GtkWidget *main_widget;
	GtkWidget *cpu_hbox;
	GtkWidget *cpu_frame;
	GtkWidget *cpuframe_vbox;
	GtkWidget *cpuclock_hbox;
	GtkWidget *baseclock_combo;
	GtkWidget *rate_combo;
	GtkWidget *times_label;
	GtkWidget *realclock_label;
	GtkWidget *confirm_widget;
	GtkWidget *ok_button;
	GtkWidget *cancel_button;
	GtkWidget *arch_frame;
	GtkWidget *arch_hbox;
	GtkWidget *arch_radiobutton[NELEMENTS(architecture)];
	GtkWidget *sound_frame;
	GtkWidget *soundframe_vbox;
	GtkWidget *soundrate_hbox;
	GtkWidget *rate_label;
	GtkWidget *rate_radiobutton[NELEMENTS(samplingrate)];
	GtkWidget *soundbuffer_hbox;
	GtkWidget *buffer_label;
	GtkWidget *ms_label;
	gchar buf[8];
	int i;

	uninstall_idle_process();

	config_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(config_dialog), "Configure");
	gtk_window_set_position(GTK_WINDOW(config_dialog), GTK_WIN_POS_CENTER);
	gtk_window_set_modal(GTK_WINDOW(config_dialog), TRUE);
	gtk_window_set_resizable(GTK_WINDOW(config_dialog), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(config_dialog), 5);

	g_signal_connect(GTK_OBJECT(config_dialog), "destroy",
	    G_CALLBACK(dialog_destroy), NULL);

	main_widget = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(main_widget);
	gtk_container_add(GTK_CONTAINER(config_dialog), main_widget);

	/* CPU column */
	cpu_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(cpu_hbox);
	gtk_box_pack_start(GTK_BOX(main_widget), cpu_hbox, TRUE, TRUE, 0);

	/*
	 * CPU frame
	 */
	cpu_frame = gtk_frame_new("CPU");
	gtk_widget_show(cpu_frame);
	gtk_box_pack_start(GTK_BOX(cpu_hbox), cpu_frame, TRUE, TRUE, 0);

	cpuframe_vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(cpuframe_vbox), 5);
	gtk_widget_show(cpuframe_vbox);
	gtk_container_add(GTK_CONTAINER(cpu_frame), cpuframe_vbox);

	/* cpu clock */
	cpuclock_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(cpuclock_hbox);
	gtk_box_pack_start(GTK_BOX(cpuframe_vbox),cpuclock_hbox, TRUE, TRUE, 2);

	baseclock_combo = gtk_combo_box_entry_new_text();
	gtk_widget_show(baseclock_combo);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), baseclock_combo, TRUE, FALSE, 0);
	gtk_widget_set_size_request(baseclock_combo, 96, -1);
	for (i = 0; i < NELEMENTS(baseclock_str); i++) {
		gtk_combo_box_append_text(GTK_COMBO_BOX(baseclock_combo), baseclock_str[i]);
	}

	baseclock_entry = GTK_BIN(baseclock_combo)->child;
	gtk_widget_show(baseclock_entry);
	gtk_editable_set_editable(GTK_EDITABLE(baseclock_entry), FALSE);
	switch (np2cfg.baseclock) {
	default:
		np2cfg.baseclock = PCBASECLOCK25;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATECLOCK);
		/*FALLTHROUGH*/
	case PCBASECLOCK25:
		gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[1]);
		break;

	case PCBASECLOCK20:
		gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[0]);
		break;
	}

	times_label = gtk_label_new("x");
	gtk_widget_show(times_label);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), times_label, TRUE, FALSE, 0);
	gtk_misc_set_padding(GTK_MISC(times_label), 5, 0);

	rate_combo = gtk_combo_box_entry_new_text();
	gtk_widget_show(rate_combo);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), rate_combo, TRUE, FALSE, 0);
	gtk_widget_set_size_request(rate_combo, 48, -1);
	for (i = 0; i < NELEMENTS(clockmult_str); i++) {
		gtk_combo_box_append_text(GTK_COMBO_BOX(rate_combo), clockmult_str[i]);
	}

	clockmult_entry = GTK_BIN(rate_combo)->child;
	gtk_widget_show(clockmult_entry);
	gtk_editable_set_editable(GTK_EDITABLE(clockmult_entry), FALSE);
	switch (np2cfg.multiple) {
	case 1: case 2: case 4: case 5: case 6: case 8: case 10: case 12:
	case 16: case 20:
		g_snprintf(buf, sizeof(buf), "%d", np2cfg.multiple);
		gtk_entry_set_text(GTK_ENTRY(clockmult_entry), buf);
		break;

	default:
		gtk_entry_set_text(GTK_ENTRY(clockmult_entry), "4");
		break;
	}

	/* calculated cpu clock */
	realclock_label = gtk_label_new("MHz");
	gtk_widget_show(realclock_label);
	gtk_box_pack_start(GTK_BOX(cpuframe_vbox), realclock_label, FALSE, FALSE, 2);
	gtk_misc_set_alignment(GTK_MISC(realclock_label), 1.0, 0.5);

	g_signal_connect(GTK_OBJECT(baseclock_entry), "changed",
	  G_CALLBACK(clock_changed), (gpointer)realclock_label);
	g_signal_connect(GTK_OBJECT(clockmult_entry), "changed",
	  G_CALLBACK(clock_changed), (gpointer)realclock_label);
	clock_changed(NULL, realclock_label);

	/* OK, Cancel button base widget */
	confirm_widget = gtk_vbutton_box_new();
	gtk_widget_show(confirm_widget);
	gtk_box_pack_start(GTK_BOX(cpu_hbox), confirm_widget, TRUE, TRUE, 0);
	gtk_button_box_set_layout(GTK_BUTTON_BOX(confirm_widget), GTK_BUTTONBOX_END);
	//gtk_button_box_set_spacing(GTK_BUTTON_BOX(confirm_widget), 0);

	/*
	 * Architecture frame
	 */
	arch_frame = gtk_frame_new("Architecture");
	gtk_widget_show(arch_frame);
	gtk_box_pack_start(GTK_BOX(main_widget), arch_frame, TRUE, TRUE, 0);

	/* architecture */
	arch_hbox = gtk_hbox_new(TRUE, 0);
	gtk_widget_show(arch_hbox);
	gtk_container_add(GTK_CONTAINER(arch_frame), arch_hbox);

	for (i = 0; i < NELEMENTS(architecture); i++) {
		arch_radiobutton[i] = gtk_radio_button_new_with_label_from_widget(i > 0 ? GTK_RADIO_BUTTON(arch_radiobutton[i-1]) : NULL, architecture[i].label);
		gtk_widget_show(arch_radiobutton[i]);
		gtk_box_pack_start(GTK_BOX(arch_hbox), arch_radiobutton[i], FALSE, FALSE, 0);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
		gtk_widget_set_can_focus(arch_radiobutton[i], FALSE);
#else
		GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS);
#endif
		g_signal_connect(GTK_OBJECT(arch_radiobutton[i]), "clicked",
		    G_CALLBACK(arch_radiobutton_clicked), (gpointer)architecture[i].arch);
	}
	for (i = 0; i < NELEMENTS(architecture); i++) {
		if (strcmp(np2cfg.model, architecture[i].arch) == 0) {
			break;
		}
	}
	if (i == NELEMENTS(architecture)) {
		i = 1;
		milstr_ncpy(np2cfg.model, "VX", sizeof(np2cfg.model));
		sysmng_update(SYS_UPDATECFG);
	}
	g_signal_emit_by_name(GTK_OBJECT(arch_radiobutton[i]), "clicked");

	/*
	 * Sound frame
	 */
	sound_frame = gtk_frame_new("Sound");
	gtk_widget_show(sound_frame);
	gtk_box_pack_start(GTK_BOX(main_widget), sound_frame, TRUE, TRUE, 0);

	soundframe_vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(soundframe_vbox), 5);
	gtk_widget_show(soundframe_vbox);
	gtk_container_add(GTK_CONTAINER(sound_frame), soundframe_vbox);

	/* sampling rate */
	soundrate_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(soundrate_hbox);
	gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundrate_hbox, TRUE, TRUE, 2);

	rate_label = gtk_label_new("Sampling Rate");
	gtk_widget_show(rate_label);
	gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_label, FALSE, TRUE, 3);
	gtk_widget_set_size_request(rate_label, 96, -1);

	for (i = 0; i < NELEMENTS(samplingrate); i++) {
		rate_radiobutton[i] = gtk_radio_button_new_with_label_from_widget((i > 0) ? GTK_RADIO_BUTTON(rate_radiobutton[i-1]) : NULL, samplingrate[i].label);
		gtk_widget_show(rate_radiobutton[i]);
		gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_radiobutton[i], FALSE, FALSE, 0);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
		gtk_widget_set_can_focus(rate_radiobutton[i], FALSE);
#else
		GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS);
#endif
		g_signal_connect(GTK_OBJECT(rate_radiobutton[i]), "clicked",
		    G_CALLBACK(rate_radiobutton_clicked), GINT_TO_POINTER(samplingrate[i].rate));
	}
	if (np2cfg.samplingrate == 11025) {
		i = 0;
	} else if (np2cfg.samplingrate == 22050) {
		i = 1;
	} else if (np2cfg.samplingrate == 44100) {
		i = 2;
	} else {
		i = 1;
		np2cfg.samplingrate = 22050;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATERATE);
	}
	g_signal_emit_by_name(GTK_OBJECT(rate_radiobutton[i]), "clicked");

	soundbuffer_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(soundbuffer_hbox);
	gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundbuffer_hbox, TRUE, TRUE, 2);

	/* buffer size */
	buffer_label = gtk_label_new("Buffer");
	gtk_widget_show(buffer_label);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_label, FALSE, FALSE, 0);
	gtk_widget_set_size_request(buffer_label, 96, -1);

	buffer_entry = gtk_entry_new();
	gtk_widget_show(buffer_entry);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_entry, FALSE, FALSE, 0);
	gtk_widget_set_size_request(buffer_entry, 48, -1);

	if (np2cfg.delayms >= 20 && np2cfg.delayms <= 1000) {
		g_snprintf(buf, sizeof(buf), "%d", np2cfg.delayms);
		gtk_entry_set_text(GTK_ENTRY(buffer_entry), buf);
	} else {
		gtk_entry_set_text(GTK_ENTRY(buffer_entry), "500");
		np2cfg.delayms = 500;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATESBUF);
		soundrenewal = 1;
	}

	ms_label = gtk_label_new(" ms");
	gtk_widget_show(ms_label);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox),ms_label, FALSE, FALSE, 0);

#if defined(SUPPORT_RESUME)
	/* resume */
	resume_checkbutton = gtk_check_button_new_with_label("Resume");
	gtk_widget_show(resume_checkbutton);
	gtk_box_pack_start(GTK_BOX(main_widget), resume_checkbutton, FALSE, FALSE, 1);
	if (np2oscfg.resume) {
		g_signal_emit_by_name(GTK_OBJECT(resume_checkbutton), "clicked");
	}
#endif

#if defined(GCC_CPU_ARCH_IA32)
	/* Disable MMX */
	disablemmx_checkbutton = gtk_check_button_new_with_label("Disable MMX");
	gtk_widget_show(disablemmx_checkbutton);
	gtk_box_pack_start(GTK_BOX(main_widget), disablemmx_checkbutton, FALSE, FALSE, 1);
	if (mmxflag & MMXFLAG_NOTSUPPORT) {
		gtk_widget_set_sensitive(disablemmx_checkbutton, FALSE);
	} else if (mmxflag & MMXFLAG_DISABLE) {
		g_signal_emit_by_name(GTK_OBJECT(disablemmx_checkbutton), "clicked");
	}
#endif

	/*
	 * OK, Cancel button
	 */
	ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
	gtk_widget_show(ok_button);
	gtk_container_add(GTK_CONTAINER(confirm_widget), ok_button);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
	gtk_widget_set_can_default(ok_button, TRUE);
	gtk_widget_has_default(ok_button);
#else
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT);
#endif
	g_signal_connect(GTK_OBJECT(ok_button), "clicked",
	    G_CALLBACK(ok_button_clicked), (gpointer)config_dialog);
	gtk_widget_grab_default(ok_button);

	cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
	gtk_widget_show(cancel_button);
	gtk_container_add(GTK_CONTAINER(confirm_widget), cancel_button);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
	gtk_widget_set_can_default(cancel_button, TRUE);
#else
	GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
#endif
	g_signal_connect_swapped(GTK_OBJECT(cancel_button), "clicked",
	    G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(config_dialog));

	gtk_widget_show_all(config_dialog);
}
Ejemplo n.º 30
0
GtkWidget*
create_sheets_main_dialog (void)
{
  GtkWidget *sheets_main_dialog;
  GtkWidget *dialog_vbox1;
  GtkWidget *table_sheets;
  GtkWidget *vbuttonbox;
  GtkWidget *button_copy;
  GtkWidget *button_copy_all;
  GtkWidget *button_move;
  GtkWidget *button_move_all;
  GtkWidget *optionmenu_right;
  GtkWidget *optionmenu_right_menu;
  GtkWidget *optionmenu_left;
  GtkWidget *optionmenu_left_menu;
  GtkWidget *glade_menuitem;
  GtkWidget *scrolledwindow_left;
  GtkWidget *scrolledwindow_right;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbox1;
  GtkWidget *button_new;
  GtkWidget *button_move_up;
  GtkWidget *button_move_down;
  GtkWidget *button_edit;
  GtkWidget *button_remove;
  GtkWidget *button_apply;
  GtkWidget *button_revert;
  GtkWidget *button_close;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  sheets_main_dialog = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (sheets_main_dialog), "sheets_main_dialog", sheets_main_dialog);
  gtk_window_set_title (GTK_WINDOW (sheets_main_dialog), _("Sheets and Objects"));
  gtk_window_set_role(GTK_WINDOW(sheets_main_dialog), "sheets_main_dialog");
  gtk_window_set_default_size (GTK_WINDOW (sheets_main_dialog), 506, 261);
  gtk_window_set_resizable (GTK_WINDOW (sheets_main_dialog), TRUE);

  dialog_vbox1 = GTK_DIALOG (sheets_main_dialog)->vbox;
  gtk_object_set_data (GTK_OBJECT (sheets_main_dialog), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  table_sheets = gtk_table_new (2, 3, FALSE);
  gtk_widget_ref (table_sheets);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "table_sheets", table_sheets,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table_sheets);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table_sheets, TRUE, TRUE, 0);

  vbuttonbox = gtk_vbutton_box_new ();
  gtk_widget_ref (vbuttonbox);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "vbuttonbox", vbuttonbox,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbuttonbox);
  gtk_table_attach (GTK_TABLE (table_sheets), vbuttonbox, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 17, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox), GTK_BUTTONBOX_SPREAD);

  button_copy = gtk_button_new_with_label (_("<- Copy"));
  gtk_widget_ref (button_copy);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_copy", button_copy,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_copy);
  gtk_container_add (GTK_CONTAINER (vbuttonbox), button_copy);
  gtk_widget_add_accelerator (button_copy, "clicked", accel_group,
                              GDK_c, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_copy_all = gtk_button_new_with_label (_("<- Copy All"));
  gtk_widget_ref (button_copy_all);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_copy_all", button_copy_all,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_copy_all);
  gtk_container_add (GTK_CONTAINER (vbuttonbox), button_copy_all);

  button_move = gtk_button_new_with_label (_("<- Move"));
  gtk_widget_ref (button_move);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_move", button_move,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_move);
  gtk_container_add (GTK_CONTAINER (vbuttonbox), button_move);
  gtk_widget_add_accelerator (button_move, "clicked", accel_group,
                              GDK_m, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_move_all = gtk_button_new_with_label (_("<- Move All"));
  gtk_widget_ref (button_move_all);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_move_all", button_move_all,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_move_all);
  gtk_container_add (GTK_CONTAINER (vbuttonbox), button_move_all);

  optionmenu_right = gtk_option_menu_new ();
  gtk_widget_ref (optionmenu_right);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "optionmenu_right", optionmenu_right,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (optionmenu_right);
  gtk_table_attach (GTK_TABLE (table_sheets), optionmenu_right, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  optionmenu_right_menu = gtk_menu_new ();
  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_right), optionmenu_right_menu);

  optionmenu_left = gtk_option_menu_new ();
  gtk_widget_ref (optionmenu_left);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "optionmenu_left", optionmenu_left,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (optionmenu_left);
  gtk_table_attach (GTK_TABLE (table_sheets), optionmenu_left, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  optionmenu_left_menu = gtk_menu_new ();
  glade_menuitem = gtk_menu_item_new_with_label ("");
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu_left_menu), glade_menuitem);
  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_left), optionmenu_left_menu);

  scrolledwindow_left = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow_left);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "scrolledwindow_left", scrolledwindow_left,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow_left);
  gtk_table_attach (GTK_TABLE (table_sheets), scrolledwindow_left, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_left), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  scrolledwindow_right = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow_right);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "scrolledwindow_right", scrolledwindow_right,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow_right);
  gtk_table_attach (GTK_TABLE (table_sheets), scrolledwindow_right, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_right), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  dialog_action_area1 = GTK_DIALOG (sheets_main_dialog)->action_area;
  gtk_object_set_data (GTK_OBJECT (sheets_main_dialog), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbox1 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbox1, TRUE, TRUE, 0);

  button_new = gtk_button_new_from_stock(GTK_STOCK_NEW);
  gtk_widget_ref (button_new);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_new", button_new,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_new);
  gtk_box_pack_start (GTK_BOX (hbox1), button_new, FALSE, TRUE, 0);
  gtk_widget_add_accelerator (button_new, "clicked", accel_group,
                              GDK_n, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_move_up = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
  gtk_widget_ref (button_move_up);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_move_up", button_move_up,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_move_up);
  gtk_box_pack_start (GTK_BOX (hbox1), button_move_up, FALSE, TRUE, 0);
  gtk_widget_add_accelerator (button_move_up, "clicked", accel_group,
                              GDK_u, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);
  button_move_down = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
  gtk_widget_ref (button_move_down);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_move_down", button_move_down,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_move_down);
  gtk_box_pack_start (GTK_BOX (hbox1), button_move_down, FALSE, TRUE, 0);
  gtk_widget_add_accelerator (button_move_down, "clicked", accel_group,
                              GDK_d, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_edit = gtk_button_new(); /* _with_label (_("Edit")); */
  {
    GtkWidget *label;

    label = gtk_label_new(_("Edit"));
    gtk_widget_ref(label);
    gtk_label_parse_uline(GTK_LABEL(label), _("_Edit"));
    gtk_container_add(GTK_CONTAINER(button_edit), label);
    gtk_widget_show(label);
  }
  gtk_widget_ref (button_edit);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_edit", button_edit,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_edit);
  gtk_box_pack_start (GTK_BOX (hbox1), button_edit, FALSE, TRUE, 0);
  gtk_widget_add_accelerator (button_edit, "clicked", accel_group,
                              GDK_e, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_remove = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
  gtk_widget_ref (button_remove);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_remove", button_remove,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_remove);
  gtk_box_pack_start (GTK_BOX (hbox1), button_remove, FALSE, TRUE, 0);
  gtk_widget_add_accelerator (button_remove, "clicked", accel_group,
                              GDK_r, GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY);
  gtk_widget_ref (button_apply);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_apply", button_apply,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_apply);
  gtk_box_pack_start (GTK_BOX (hbox1), button_apply, FALSE, TRUE, 0);
  gtk_widget_set_sensitive (button_apply, FALSE);

  button_revert = gtk_button_new_with_label(_("Revert"));
  gtk_widget_ref (button_revert);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_revert", button_revert,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_revert);
  gtk_box_pack_start (GTK_BOX (hbox1), button_revert, FALSE, TRUE, 0);
  gtk_widget_set_sensitive (button_revert, FALSE);

  button_close = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
  gtk_widget_ref (button_close);
  gtk_object_set_data_full (GTK_OBJECT (sheets_main_dialog), "button_close", button_close,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_close);
  gtk_box_pack_start (GTK_BOX (hbox1), button_close, FALSE, TRUE, 0);

  g_signal_connect (GTK_OBJECT (sheets_main_dialog), "delete_event",
                      G_CALLBACK (on_sheets_main_dialog_delete_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_copy), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_copy_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_copy_all), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_copy_all_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_move), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_move_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_move_all), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_move_all_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_new), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_new_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_move_up), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_move_up_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_move_down), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_move_down_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_edit), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_edit_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_remove), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_remove_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_apply), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_apply_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_revert), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_revert_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_close), "clicked",
                      G_CALLBACK (on_sheets_dialog_button_close_clicked),
                      NULL);

  gtk_window_add_accel_group (GTK_WINDOW (sheets_main_dialog), accel_group);

  persistence_register_window(GTK_WINDOW(sheets_main_dialog));

  return sheets_main_dialog;
}