예제 #1
0
파일: joind.c 프로젝트: DoctorWho11/pchat
static void
joind_show_dialog (server *serv)
{
    GtkWidget *dialog1;
    GtkWidget *dialog_vbox1;
    GtkWidget *vbox1;
    GtkWidget *hbox1;
    GtkWidget *image1;
    GtkWidget *vbox2;
    GtkWidget *label;
    GtkWidget *radiobutton1;
    GtkWidget *radiobutton2;
    GtkWidget *radiobutton3;
    GSList *radiobutton1_group;
    GtkWidget *hbox2;
    GtkWidget *entry1;
    GtkWidget *checkbutton1;
    GtkWidget *dialog_action_area1;
    GtkWidget *okbutton1;
    char buf[256];
    char buf2[256];

    serv->gui->joind_win = dialog1 = gtk_dialog_new ();
    gtk_window_set_title (GTK_WINDOW (dialog1), _(DISPLAY_NAME": Connection Complete"));
    gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_window_set_position (GTK_WINDOW (dialog1), GTK_WIN_POS_CENTER_ON_PARENT);
    gtk_window_set_transient_for (GTK_WINDOW(dialog1), GTK_WINDOW(serv->front_session->gui->window));
    gtk_window_set_modal (GTK_WINDOW (dialog1), TRUE);
    gtk_window_set_resizable (GTK_WINDOW (dialog1), FALSE);

    dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog1));
    gtk_widget_show (dialog_vbox1);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

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

    image1 = gtk_image_new_from_stock (GTK_STOCK_NETWORK, GTK_ICON_SIZE_LARGE_TOOLBAR);
    gtk_widget_show (image1);
    gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, TRUE, 24);
    gtk_misc_set_alignment (GTK_MISC (image1), 0.5, 0.06);

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

    snprintf (buf2, sizeof (buf2), _("Connection to %s complete."),
              server_get_network (serv, TRUE));
    snprintf (buf, sizeof (buf), "\n<b>%s</b>", buf2);
    label = gtk_label_new (buf);
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

    label = gtk_label_new (_("In the Server-List window, no channel (chat room) has been entered to be automatically joined for this network."));
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

    label = gtk_label_new (_("What would you like to do next?"));
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

    serv->gui->joind_radio1 = radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, _("_Nothing, I'll join a channel later."));
    gtk_widget_show (radiobutton1);
    gtk_box_pack_start (GTK_BOX (vbox2), radiobutton1, FALSE, FALSE, 0);
    radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1));

    hbox2 = gtk_hbox_new (FALSE, 0);
    gtk_widget_show (hbox2);
    gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);

    serv->gui->joind_radio2 = radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, _("_Join this channel:"));
    gtk_widget_show (radiobutton2);
    gtk_box_pack_start (GTK_BOX (hbox2), radiobutton2, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobutton1_group);
    radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2));

    serv->gui->joind_entry = entry1 = gtk_entry_new ();
    gtk_entry_set_text (GTK_ENTRY (entry1), "#");
    gtk_widget_show (entry1);
    gtk_box_pack_start (GTK_BOX (hbox2), entry1, TRUE, TRUE, 8);

    snprintf (buf, sizeof (buf), "<small>     %s</small>",
              _("If you know the name of the channel you want to join, enter it here."));
    label = gtk_label_new (buf);
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

    radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, _("O_pen the Channel-List window."));
    gtk_widget_show (radiobutton3);
    gtk_box_pack_start (GTK_BOX (vbox2), radiobutton3, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group);
    radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3));

    snprintf (buf, sizeof (buf), "<small>     %s</small>",
              _("Retrieving the Channel-List may take a minute or two."));
    label = gtk_label_new (buf);
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

    serv->gui->joind_check = checkbutton1 = gtk_check_button_new_with_mnemonic (_("_Always show this dialog after connecting."));
    if (prefs.pchat_gui_join_dialog)
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton1), TRUE);
    gtk_widget_show (checkbutton1);
    gtk_box_pack_start (GTK_BOX (vbox1), checkbutton1, FALSE, FALSE, 0);

    dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (dialog1));
    gtk_widget_show (dialog_action_area1);
    gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

    okbutton1 = gtk_button_new_from_stock ("gtk-ok");
    gtk_widget_show (okbutton1);
    gtk_box_pack_end (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog1))), okbutton1, FALSE, TRUE, 0);
    gtk_widget_set_can_default (okbutton1, TRUE);

    g_signal_connect (G_OBJECT (dialog1), "destroy",
                      G_CALLBACK (joind_destroy_cb), serv);
    g_signal_connect (G_OBJECT (entry1), "focus_in_event",
                      G_CALLBACK (joind_entryfocus_cb), serv);
    g_signal_connect (G_OBJECT (entry1), "activate",
                      G_CALLBACK (joind_entryenter_cb), okbutton1);
    g_signal_connect (G_OBJECT (radiobutton2), "toggled",
                      G_CALLBACK (joind_radio2_cb), serv);
    g_signal_connect (G_OBJECT (okbutton1), "clicked",
                      G_CALLBACK (joind_ok_cb), serv);

    if (serv->network)
        if (g_ascii_strcasecmp(((ircnet*)serv->network)->name, "freenode") == 0)
        {
            gtk_entry_set_text (GTK_ENTRY (entry1), "#valhallalinux");
            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radiobutton2), TRUE);
        }

    gtk_widget_grab_focus (okbutton1);
    gtk_widget_show_all (dialog1);
}
예제 #2
0
파일: interface.c 프로젝트: pvital/time2do
GtkWidget*
create_main_window (char *str2print)
{
  GtkWidget *main_window;
  GtkWidget *fixed1;
  GtkWidget *main_label;
  GtkWidget *ok_button;
  GtkWidget *image;
  GtkTooltips *tooltips;
  int pos1 = 300, pos2 = 100;
  int label_size = 0, str_is_big = 0, has_mail = 0;

  tooltips = gtk_tooltips_new ();

  if (strlen(str2print) > 23)
      str_is_big = 1;
  if (!strncmp (str2print, "mail", 4)) {
      //has_mail = 1;
      str2print = "You have mail !!!";
  }

  /* creating the window */
  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  if (str_is_big)
      pos1 = pos1+100;
  if (has_mail)
      pos2 = pos2+70;
  gtk_window_set_default_size (GTK_WINDOW (main_window), pos1, pos2);
  gtk_window_set_title (GTK_WINDOW (main_window), _("time2do"));
  gtk_window_set_position (GTK_WINDOW (main_window), GTK_WIN_POS_CENTER);
  gtk_window_set_resizable (GTK_WINDOW (main_window), TRUE);

  /* creating and adding the fixed */
  fixed1 = gtk_fixed_new ();
  gtk_widget_show (fixed1);
  gtk_container_add (GTK_CONTAINER (main_window), fixed1);

  /* mail string */
  if (has_mail) {
      // add the pixmap/mail.png icon 
      image = gtk_image_new_from_file ("/home/pvital/my_files/projects/Projects/time2do//pixmap/mail.png");
      if (image) {
        gtk_widget_show (image);
        pos1 = (pos1/2)-32;
        gtk_fixed_put (GTK_FIXED (fixed1), image, pos1, 8);
        gtk_widget_set_size_request (image, 64, 64);
      }
  }    
  
  /* adding the label */
  main_label = gtk_label_new (NULL);
  gtk_label_set_width_chars (GTK_LABEL (main_label), strlen(str2print));
  gtk_label_set_text (GTK_LABEL (main_label), str2print);
  gtk_widget_show (main_label);

  if (str_is_big) {
      /* used when the label is large than 23 characters */
      pos1 = 5;
      label_size = 380;
  } else {
      /* used when the label is small */
      pos1 = 56;
      label_size = 184;
  }

  if (has_mail)
      pos2 = 8+70;
  else
      pos2 = 8;

  gtk_fixed_put (GTK_FIXED (fixed1), main_label, pos1, pos2);
  gtk_widget_set_size_request (main_label, label_size, 24);
  gtk_label_set_justify (GTK_LABEL (main_label), GTK_JUSTIFY_CENTER);
  gtk_label_set_line_wrap (GTK_LABEL (main_label), TRUE);
  gtk_label_set_ellipsize (GTK_LABEL (main_label), PANGO_ELLIPSIZE_MIDDLE);

  /* adding the OK button */
  pos1 = 120;
  ok_button = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (ok_button);
  if (str_is_big)
      pos1 = pos1+55;
  if (has_mail)
      pos2 = 48+70;
  else
      pos2 = 48;
  gtk_fixed_put (GTK_FIXED (fixed1), ok_button, pos1, pos2);
  gtk_widget_set_size_request (ok_button, 62, 29);
  gtk_tooltips_set_tip (tooltips, ok_button, _("Click here to close this window."), NULL);

  g_signal_connect ((gpointer) ok_button, "clicked",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window");
  GLADE_HOOKUP_OBJECT (main_window, fixed1, "fixed1");
  if (has_mail)
      GLADE_HOOKUP_OBJECT (main_window, image, "image");
  GLADE_HOOKUP_OBJECT (main_window, main_label, "main_label");
  GLADE_HOOKUP_OBJECT (main_window, ok_button, "ok_button");
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, tooltips, "tooltips");

  return main_window;
}
예제 #3
0
파일: loginbox.c 프로젝트: MavenRain/iODBC
void
create_login (HWND hwnd, LPCSTR username, LPCSTR password, LPCSTR dsn,
    TLOGIN *log_t)
{
  GtkWidget *login;
  GtkWidget *dialog_vbox8;
  GtkWidget *frame99;
  GtkWidget *alignment83;
  GtkWidget *table9;
  GtkWidget *label165;
  GtkWidget *t_user;
  GtkWidget *t_password;
  GtkWidget *label164;
  GtkWidget *dialog_action_area8;
  GtkWidget *b_ok;
  GtkWidget *b_cancel;
  char buff[1024];

  if (hwnd == (HWND) - 1L)
    {
      gtk_init (0, NULL);
      hwnd = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    }

  if (hwnd == NULL || !GTK_IS_WIDGET (hwnd))
    return;

  login = gtk_dialog_new ();
  gtk_widget_set_name (login, "login");
  gtk_widget_set_size_request (login, 400, 150);
  sprintf (buff, "Login for DSN %s ...", (dsn) ? dsn : "Unknown");
  gtk_window_set_title (GTK_WINDOW (login), buff);
  gtk_window_set_position (GTK_WINDOW (login), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (login), TRUE);
  gtk_window_set_default_size (GTK_WINDOW (login), 400, 150);
  gtk_window_set_type_hint (GTK_WINDOW (login), GDK_WINDOW_TYPE_HINT_DIALOG);

#if GTK_CHECK_VERSION(2,0,0)
  gtk_widget_show (login);
#endif

  dialog_vbox8 = GTK_DIALOG (login)->vbox;
  gtk_widget_set_name (dialog_vbox8, "dialog_vbox8");
  gtk_widget_show (dialog_vbox8);

  frame99 = gtk_frame_new (NULL);
  gtk_widget_set_name (frame99, "frame99");
  gtk_widget_show (frame99);
  gtk_box_pack_start (GTK_BOX (dialog_vbox8), frame99, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame99), GTK_SHADOW_NONE);

  alignment83 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_set_name (alignment83, "alignment83");
  gtk_widget_show (alignment83);
  gtk_container_add (GTK_CONTAINER (frame99), alignment83);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment83), 4, 0, 6, 7);

  table9 = gtk_table_new (2, 2, FALSE);
  gtk_widget_set_name (table9, "table9");
  gtk_widget_show (table9);
  gtk_container_add (GTK_CONTAINER (alignment83), table9);
  gtk_table_set_row_spacings (GTK_TABLE (table9), 10);
  gtk_table_set_col_spacings (GTK_TABLE (table9), 6);

  label165 = gtk_label_new (_("Password :"******"label165");
  gtk_widget_show (label165);
  gtk_table_attach (GTK_TABLE (table9), label165, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label165), 0, 0.5);

  t_user = gtk_entry_new ();
  gtk_widget_set_name (t_user, "t_user");
  gtk_widget_show (t_user);
  gtk_table_attach (GTK_TABLE (table9), t_user, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  if (username && STRLEN (username))
    gtk_entry_set_text (GTK_ENTRY (t_user), username);

  t_password = gtk_entry_new ();
  gtk_widget_set_name (t_password, "t_password");
  gtk_widget_show (t_password);
  gtk_table_attach (GTK_TABLE (table9), t_password, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_entry_set_visibility (GTK_ENTRY (t_password), FALSE);
  if (password && STRLEN (password))
    gtk_entry_set_text (GTK_ENTRY (t_password), password);

  label164 = gtk_label_new (_("Username :"******"label164");
  gtk_widget_show (label164);
  gtk_table_attach (GTK_TABLE (table9), label164, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label164), 0, 0.5);

  dialog_action_area8 = GTK_DIALOG (login)->action_area;
  gtk_widget_set_name (dialog_action_area8, "dialog_action_area8");
  gtk_widget_show (dialog_action_area8);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area8), GTK_BUTTONBOX_END);

  b_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_set_name (b_cancel, "b_cancel");
  gtk_widget_show (b_cancel);
  gtk_dialog_add_action_widget (GTK_DIALOG (login), b_cancel, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT);

  b_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_set_name (b_ok, "b_ok");
  gtk_widget_show (b_ok);
  gtk_dialog_add_action_widget (GTK_DIALOG (login), b_ok, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (b_ok, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (login, login, "login");
  GLADE_HOOKUP_OBJECT_NO_REF (login, dialog_vbox8, "dialog_vbox8");
  GLADE_HOOKUP_OBJECT (login, frame99, "frame99");
  GLADE_HOOKUP_OBJECT (login, alignment83, "alignment83");
  GLADE_HOOKUP_OBJECT (login, table9, "table9");
  GLADE_HOOKUP_OBJECT (login, label165, "label165");
  GLADE_HOOKUP_OBJECT (login, t_user, "t_user");
  GLADE_HOOKUP_OBJECT (login, t_password, "t_password");
  GLADE_HOOKUP_OBJECT (login, label164, "label164");
  GLADE_HOOKUP_OBJECT_NO_REF (login, dialog_action_area8, "dialog_action_area8");
  GLADE_HOOKUP_OBJECT (login, b_ok, "b_ok");
  GLADE_HOOKUP_OBJECT (login, b_cancel, "b_cancel");

  /* Ok button events */
  gtk_signal_connect (GTK_OBJECT (b_ok), "clicked",
      GTK_SIGNAL_FUNC (login_ok_clicked), log_t);
  /* Cancel button events */
  gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked",
      GTK_SIGNAL_FUNC (login_cancel_clicked), log_t);
  /* Close window button events */
  gtk_signal_connect (GTK_OBJECT (login), "delete_event",
      GTK_SIGNAL_FUNC (delete_event), log_t);
  gtk_signal_connect (GTK_OBJECT (login), "destroy",
      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

  log_t->username = t_user;
  log_t->password = t_password;
  log_t->user = log_t->pwd = NULL;
  log_t->mainwnd = login;

  gtk_widget_show_all (login);
  gtk_main ();
}
예제 #4
0
GtkWidget*
create_sheets_remove_dialog (void)
{
  GtkWidget *sheets_remove_dialog;
  GtkWidget *dialog_vbox4;
  GtkWidget *frame;
  GtkWidget *table7;
  GSList *table7_group = NULL;
  GtkWidget *radiobutton_object;
  GtkWidget *frame_object_pixmap;
  GtkWidget *pixmap_object;
  GtkWidget *radiobutton_sheet;
  GtkWidget *entry_object;
  GtkWidget *entry_sheet;
  GtkWidget *dialog_action_area4;
  GtkWidget *hbuttonbox3;
  GtkWidget *button_ok;
  GtkWidget *button_cancel;

  sheets_remove_dialog = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (sheets_remove_dialog),
                       "sheets_remove_dialog", sheets_remove_dialog);
  gtk_window_set_title (GTK_WINDOW (sheets_remove_dialog), _("Remove"));
  gtk_window_set_default_size (GTK_WINDOW (sheets_remove_dialog), 316, -1);
  gtk_window_set_role (GTK_WINDOW (sheets_remove_dialog),
                       "sheets_remove_dialog");
  gtk_window_set_resizable (GTK_WINDOW (sheets_remove_dialog), TRUE);

  dialog_vbox4 = GTK_DIALOG (sheets_remove_dialog)->vbox;
  gtk_object_set_data (GTK_OBJECT (sheets_remove_dialog), "dialog_vbox4", dialog_vbox4);
  gtk_widget_show (dialog_vbox4);

  frame = gtk_frame_new (_("Type"));
  gtk_widget_ref (frame);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "frame", frame,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame);
  gtk_box_pack_start (GTK_BOX (dialog_vbox4), frame, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame), 5);

  table7 = gtk_table_new (3, 2, FALSE);
  gtk_widget_ref (table7);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "table7", table7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table7);
  gtk_container_add (GTK_CONTAINER (frame), table7);

  radiobutton_object = gtk_radio_button_new_with_label (table7_group, _("DiaObject:"));
  table7_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_object));
  gtk_widget_ref (radiobutton_object);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "radiobutton_object", radiobutton_object,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton_object);
  gtk_table_attach (GTK_TABLE (table7), radiobutton_object, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  frame_object_pixmap = gtk_frame_new (NULL);
  gtk_widget_ref (frame_object_pixmap);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "frame_object_pixmap", frame_object_pixmap,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame_object_pixmap);
  gtk_table_attach (GTK_TABLE (table7), frame_object_pixmap, 0, 1, 0, 1,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_object_pixmap), GTK_SHADOW_ETCHED_OUT);

  pixmap_object = create_pixmap (sheets_remove_dialog, NULL, FALSE);
  gtk_widget_ref (pixmap_object);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "pixmap_object", pixmap_object,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap_object);
  gtk_container_add (GTK_CONTAINER (frame_object_pixmap), pixmap_object);

  radiobutton_sheet = gtk_radio_button_new_with_label (table7_group, _("Sheet:"));
  table7_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_sheet));
  gtk_widget_ref (radiobutton_sheet);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "radiobutton_sheet", radiobutton_sheet,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton_sheet);
  gtk_table_attach (GTK_TABLE (table7), radiobutton_sheet, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  entry_object = gtk_entry_new ();
  gtk_widget_ref (entry_object);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "entry_object", entry_object,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_object);
  gtk_table_attach (GTK_TABLE (table7), entry_object, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_entry_set_editable (GTK_ENTRY (entry_object), FALSE);

  entry_sheet = gtk_entry_new ();
  gtk_widget_ref (entry_sheet);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "entry_sheet", entry_sheet,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_sheet);
  gtk_table_attach (GTK_TABLE (table7), entry_sheet, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_entry_set_editable (GTK_ENTRY (entry_sheet), FALSE);

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

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_ref (hbuttonbox3);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "hbuttonbox3", hbuttonbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (dialog_action_area4), hbuttonbox3, TRUE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox3), GTK_BUTTONBOX_END);
  gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox3), 0);

  button_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button_ok);
  GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);

  button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
  gtk_widget_ref (button_cancel);
  gtk_object_set_data_full (GTK_OBJECT (sheets_remove_dialog), "button_cancel", button_cancel,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button_cancel);
  GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);

  g_signal_connect (GTK_OBJECT (radiobutton_object), "toggled",
                      G_CALLBACK (on_sheets_remove_dialog_radiobutton_object_toggled),
                      NULL);
  g_signal_connect (GTK_OBJECT (radiobutton_sheet), "toggled",
                      G_CALLBACK (on_sheets_remove_dialog_radiobutton_sheet_toggled),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_ok), "clicked",
                      G_CALLBACK (on_sheets_remove_dialog_button_ok_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_cancel), "clicked",
                      G_CALLBACK (on_sheets_remove_dialog_button_cancel_clicked),
                      NULL);

  gtk_widget_grab_default (button_ok);
  return sheets_remove_dialog;
}
예제 #5
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *scrolledwindow1;
  GtkWidget *treeview1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Recent files"));

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

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);

  //__________ PATCH BEGIN HERE_________________________
   store = gtk_list_store_new (1,  G_TYPE_STRING);
   treeview1 = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
   GtkTreeViewColumn *column;
   GtkCellRenderer *renderer;
  renderer = gtk_cell_renderer_text_new ();
   /* Create a column, associating the "text" attribute of the
    * cell_renderer to the first column of the model */
   column = gtk_tree_view_column_new_with_attributes ("File", renderer,
                                                      "text", 0,
                                                      NULL);
   /* Add the column to the view. */
   gtk_tree_view_append_column (GTK_TREE_VIEW (treeview1), column);
   //_______________PATCH END HERE____________________



 // treeview1 = gtk_tree_view_new ();
  gtk_widget_show (treeview1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview1);
  gtk_container_set_border_width (GTK_CONTAINER (treeview1), 1);
    gtk_widget_set_size_request (treeview1, 400, 150);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview1), TRUE);
  gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview1), FALSE);

  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, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (dialog1, treeview1, "treeview1");
  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;
}
예제 #6
0
static void mp3_configure(void)
{
    gint i;

    if (!configure_win) {
        configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_type_hint(GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG);

        g_signal_connect (configure_win, "destroy", (GCallback)
         gtk_widget_destroyed, & configure_win);
        gtk_window_set_title(GTK_WINDOW(configure_win),
                             _("MP3 Configuration"));
        gtk_window_set_position(GTK_WINDOW(configure_win),
                                GTK_WIN_POS_MOUSE);
        gtk_container_set_border_width(GTK_CONTAINER(configure_win), 5);

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

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


        /* Quality */

        quality_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(quality_vbox), 5);

        quality_hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_box_pack_start(GTK_BOX(quality_vbox), quality_hbox1, FALSE,
                           FALSE, 0);

        /* Algorithm Quality */

        alg_quality_frame = gtk_frame_new(_("Algorithm Quality:"));
        gtk_container_set_border_width(GTK_CONTAINER(alg_quality_frame),
                                       5);
        gtk_box_pack_start(GTK_BOX(quality_hbox1), alg_quality_frame,
                           FALSE, FALSE, 0);

        alg_quality_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(alg_quality_hbox),
                                       10);
        gtk_container_add(GTK_CONTAINER(alg_quality_frame),
                          alg_quality_hbox);

        alg_quality_adj = (GtkAdjustment *) gtk_adjustment_new (5, 0, 9, 1, 1, 0);
        alg_quality_spin =
            gtk_spin_button_new(GTK_ADJUSTMENT(alg_quality_adj), 8, 0);
        gtk_box_pack_start(GTK_BOX(alg_quality_hbox), alg_quality_spin,
                           TRUE, TRUE, 0);
        g_signal_connect (alg_quality_adj, "value-changed", (GCallback)
         algo_qual, NULL);

        gtk_spin_button_set_value(GTK_SPIN_BUTTON(alg_quality_spin),
                                  algo_quality_val);

        /* Output Samplerate */

        samplerate_frame = gtk_frame_new(_("Output Samplerate:"));
        gtk_container_set_border_width(GTK_CONTAINER(samplerate_frame), 5);
        gtk_box_pack_start(GTK_BOX(quality_hbox1), samplerate_frame, FALSE,
                           FALSE, 0);

        samplerate_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(samplerate_hbox), 10);
        gtk_container_add(GTK_CONTAINER(samplerate_frame),
                          samplerate_hbox);

        GtkWidget * combo = gtk_combo_box_text_new ();
        gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, _("Auto"));
        if (! out_samplerate_val)
            gtk_combo_box_set_active ((GtkComboBox *) combo, 0);

        for (i = 0; i < G_N_ELEMENTS (available_samplerates); i ++)
        {
            gchar buf[10];
            snprintf (buf, sizeof buf, "%d", available_samplerates[i]);
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, buf);

            if (out_samplerate_val == available_samplerates[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, 1 + i);
        }

        gtk_box_pack_start ((GtkBox *) samplerate_hbox, combo, FALSE, FALSE, 0);
        g_signal_connect (combo, "changed", (GCallback) samplerate_changed, NULL);

        samplerate_label = gtk_label_new(_("(Hz)"));
        gtk_misc_set_alignment(GTK_MISC(samplerate_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(samplerate_hbox), samplerate_label,
                           FALSE, FALSE, 0);

        /* Encoder Quality */

        enc_quality_frame = gtk_frame_new(_("Bitrate / Compression ratio:"));
        gtk_container_set_border_width(GTK_CONTAINER(enc_quality_frame),
                                       5);
        gtk_box_pack_start(GTK_BOX(quality_vbox), enc_quality_frame, FALSE,
                           FALSE, 0);

        // vbox sorrounding hbox1 and hbox2
        enc_quality_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(enc_quality_vbox), 10);

        // pack vbox to frame
        gtk_container_add(GTK_CONTAINER(enc_quality_frame), enc_quality_vbox);

        // hbox1 for bitrate
        hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox1);

        // radio 1
        enc_radio1 = gtk_radio_button_new(NULL);
        if (enc_toggle_val == 0)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio1), TRUE);
        gtk_box_pack_start(GTK_BOX(hbox1), enc_radio1, FALSE, FALSE, 0);

        // label 1
        enc_quality_label1 = gtk_label_new(_("Bitrate (kbps):"));
        gtk_box_pack_start(GTK_BOX(hbox1), enc_quality_label1, FALSE, FALSE, 0);

        // bitrate menu

        combo = gtk_combo_box_text_new ();

        for (i = 0; i < G_N_ELEMENTS (available_bitrates); i ++)
        {
            gchar buf[10];
            snprintf (buf, sizeof buf, "%d", available_bitrates[i]);
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, buf);

            if (bitrate_val == available_bitrates[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, i);
        }

        gtk_box_pack_start ((GtkBox *) hbox1, combo, FALSE, FALSE, 0);
        g_signal_connect (combo, "changed", (GCallback) bitrate_changed, NULL);

        // hbox2 for compression ratio
        hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox2);

        // radio 2
        enc_radio2 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(enc_radio1));
        if (enc_toggle_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio2),
                                         TRUE);
        // pack radio 2
        gtk_box_pack_start(GTK_BOX(hbox2), enc_radio2, FALSE, FALSE, 0);

        // label
        enc_quality_label2 = gtk_label_new(_("Compression ratio:"));
        gtk_box_pack_start(GTK_BOX(hbox2), enc_quality_label2, FALSE, FALSE, 0);

        // comp-ratio spin
        compression_adj = (GtkAdjustment *) gtk_adjustment_new (11, 0, 100, 1,
         1, 0);
        compression_spin =
            gtk_spin_button_new(GTK_ADJUSTMENT(compression_adj), 8, 0);
        gtk_box_pack_end(GTK_BOX(hbox2), compression_spin, FALSE, FALSE, 0);

        g_signal_connect (compression_adj, "value-changed", (GCallback)
         compression_change, NULL);

        gtk_spin_button_set_value(GTK_SPIN_BUTTON(compression_spin),
                                  compression_val);

        // radio button signale connect
        g_signal_connect (enc_radio1, "toggled", (GCallback) encoding_toggle,
         GINT_TO_POINTER (0));
        g_signal_connect (enc_radio2, "toggled", (GCallback) encoding_toggle,
         GINT_TO_POINTER (1));

        /* Audio Mode */

        mode_frame = gtk_frame_new(_("Audio Mode:"));
        gtk_container_set_border_width(GTK_CONTAINER(mode_frame), 5);
        gtk_box_pack_start(GTK_BOX(quality_vbox), mode_frame, FALSE, FALSE,
                           0);

        mode_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
        gtk_container_set_border_width(GTK_CONTAINER(mode_hbox), 10);
        gtk_container_add(GTK_CONTAINER(mode_frame), mode_hbox);

        combo = gtk_combo_box_text_new ();

        for (i = 0; i < MODES; i ++)
        {
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo,
             _(mode_names[i]));

            if (audio_mode_val == modes[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, i);
        }

        gtk_box_pack_start ((GtkBox *) mode_hbox, combo, FALSE, FALSE, 0);
        g_signal_connect (combo, "changed", (GCallback) mode_changed, NULL);

        /* Misc */

        misc_frame = gtk_frame_new(_("Misc:"));
        gtk_container_set_border_width(GTK_CONTAINER(misc_frame), 5);
        gtk_box_pack_start(GTK_BOX(quality_vbox), misc_frame, FALSE, FALSE,
                           0);

        misc_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(misc_vbox), 5);
        gtk_container_add(GTK_CONTAINER(misc_frame), misc_vbox);

        enforce_iso_toggle =
            gtk_check_button_new_with_label
            (_("Enforce strict ISO complience"));
        gtk_box_pack_start(GTK_BOX(misc_vbox), enforce_iso_toggle, TRUE,
                           TRUE, 2);
        g_signal_connect (enforce_iso_toggle, "toggled", (GCallback)
         toggle_enforce_iso, NULL);

        if (enforce_iso_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (enforce_iso_toggle), TRUE);

        error_protection_toggle =
            gtk_check_button_new_with_label(_("Error protection"));
        gtk_box_pack_start(GTK_BOX(misc_vbox), error_protection_toggle,
                           TRUE, TRUE, 2);
        g_signal_connect (error_protection_toggle, "toggled", (GCallback)
         toggle_error_protect, NULL);

        if (error_protect_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (error_protection_toggle), TRUE);

        /* Add the Notebook */
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), quality_vbox,
                                 gtk_label_new(_("Quality")));


        /* VBR/ABR */

        vbr_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_vbox), 5);

        /* Toggle VBR */

        vbr_toggle = gtk_check_button_new_with_label(_("Enable VBR/ABR"));
        gtk_box_pack_start(GTK_BOX(vbr_vbox), vbr_toggle, FALSE, FALSE, 2);
        g_signal_connect (vbr_toggle, "toggled", (GCallback) toggle_vbr, NULL);

        vbr_options_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
        gtk_container_add(GTK_CONTAINER(vbr_vbox), vbr_options_vbox);
        gtk_widget_set_sensitive(vbr_options_vbox, FALSE);

        /* Choose VBR/ABR */

        vbr_type_frame = gtk_frame_new(_("Type:"));
        gtk_container_set_border_width(GTK_CONTAINER(vbr_type_frame), 5);
        gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_type_frame,
                           FALSE, FALSE, 2);

        vbr_type_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_type_hbox), 5);
        gtk_container_add(GTK_CONTAINER(vbr_type_frame), vbr_type_hbox);

        vbr_type_radio1 = gtk_radio_button_new_with_label(NULL, "VBR");
        gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio1, TRUE,
                           TRUE, 2);
        if (vbr_type == 0)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (vbr_type_radio1), TRUE);

        vbr_type_radio2 =
            gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON
                                                        (vbr_type_radio1),
                                                        "ABR");
        gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio2, TRUE,
                           TRUE, 2);
        if (vbr_type == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (vbr_type_radio2), TRUE);

        g_signal_connect (vbr_type_radio1, "toggled", (GCallback)
         vbr_abr_toggle, "VBR");
        g_signal_connect (vbr_type_radio2, "toggled", (GCallback)
         vbr_abr_toggle, "ABR");

        /* VBR Options */

        vbr_frame = gtk_frame_new(_("VBR Options:"));
        gtk_container_set_border_width(GTK_CONTAINER(vbr_frame), 5);
        gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_frame, FALSE,
                           FALSE, 2);

        vbr_options_vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_options_vbox2),
                                       5);
        gtk_container_add(GTK_CONTAINER(vbr_frame), vbr_options_vbox2);

        vbr_options_hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox1),
                                       5);
        gtk_container_add(GTK_CONTAINER(vbr_options_vbox2),
                          vbr_options_hbox1);

        vbr_min_label = gtk_label_new(_("Minimum bitrate (kbps):"));
        gtk_misc_set_alignment(GTK_MISC(vbr_min_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(vbr_options_hbox1), vbr_min_label, TRUE,
                           TRUE, 0);

        combo = gtk_combo_box_text_new ();

        for (i = 0; i < G_N_ELEMENTS (available_bitrates); i ++)
        {
            gchar buf[10];
            snprintf (buf, sizeof buf, "%d", available_bitrates[i]);
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, buf);

            if (vbr_min_val == available_bitrates[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, i);
        }

        gtk_box_pack_start ((GtkBox *) vbr_options_hbox1, combo, FALSE, FALSE,
         0);
        g_signal_connect (combo, "changed", (GCallback) vbr_min_changed, NULL);

        vbr_options_hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox2),
                                       5);
        gtk_container_add(GTK_CONTAINER(vbr_options_vbox2),
                          vbr_options_hbox2);

        vbr_max_label = gtk_label_new(_("Maximum bitrate (kbps):"));
        gtk_misc_set_alignment(GTK_MISC(vbr_max_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(vbr_options_hbox2), vbr_max_label, TRUE,
                           TRUE, 0);

        combo = gtk_combo_box_text_new ();

        for (i = 0; i < G_N_ELEMENTS (available_bitrates); i ++)
        {
            gchar buf[10];
            snprintf (buf, sizeof buf, "%d", available_bitrates[i]);
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, buf);

            if (vbr_max_val == available_bitrates[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, i);
        }

        gtk_box_pack_start ((GtkBox *) vbr_options_hbox2, combo, FALSE, FALSE,
         0);
        g_signal_connect (combo, "changed", (GCallback) vbr_max_changed, NULL);

        enforce_min_toggle =
            gtk_check_button_new_with_label
            (_("Strictly enforce minimum bitrate"));
        gtk_box_pack_start(GTK_BOX(vbr_options_vbox2), enforce_min_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (enforce_min_toggle, "toggled", (GCallback)
         toggle_enforce_min, NULL);

        if (enforce_min_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (enforce_min_toggle), TRUE);

        /* ABR Options */

        abr_frame = gtk_frame_new(_("ABR Options:"));
        gtk_container_set_border_width(GTK_CONTAINER(abr_frame), 5);
        gtk_box_pack_start(GTK_BOX(vbr_options_vbox), abr_frame, FALSE,
                           FALSE, 2);
        gtk_widget_set_sensitive(abr_frame, FALSE);

        abr_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(abr_hbox), 5);
        gtk_container_add(GTK_CONTAINER(abr_frame), abr_hbox);

        abr_label = gtk_label_new(_("Average bitrate (kbps):"));
        gtk_misc_set_alignment(GTK_MISC(abr_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(abr_hbox), abr_label, TRUE, TRUE, 0);

        combo = gtk_combo_box_text_new ();

        for (i = 0; i < G_N_ELEMENTS (available_bitrates); i ++)
        {
            gchar buf[10];
            snprintf (buf, sizeof buf, "%d", available_bitrates[i]);
            gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, buf);

            if (abr_val == available_bitrates[i])
                gtk_combo_box_set_active ((GtkComboBox *) combo, i);
        }

        gtk_box_pack_start ((GtkBox *) abr_hbox, combo, FALSE, FALSE,
         0);
        g_signal_connect (combo, "changed", (GCallback) abr_changed, NULL);

        /* Quality Level */

        vbr_options_hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox3),
                                       5);
        gtk_container_add(GTK_CONTAINER(vbr_options_vbox),
                          vbr_options_hbox3);

        vbr_quality_label = gtk_label_new(_("VBR quality level:"));
        gtk_misc_set_alignment(GTK_MISC(vbr_quality_label), 0, 0.5);
        gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_label,
                           TRUE, TRUE, 0);

        vbr_quality_adj = (GtkAdjustment *) gtk_adjustment_new (4, 0, 9, 1, 1, 0);
        vbr_quality_spin =
            gtk_spin_button_new(GTK_ADJUSTMENT(vbr_quality_adj), 8, 0);
        gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_spin,
                           TRUE, TRUE, 0);
        g_signal_connect (vbr_quality_adj, "value-changed", (GCallback)
         vbr_qual, NULL);

        gtk_spin_button_set_value(GTK_SPIN_BUTTON(vbr_quality_spin),
                                  vbr_quality_val);

        /* Xing Header */

        xing_header_toggle =
            gtk_check_button_new_with_label(_("Don't write Xing VBR header"));
        gtk_box_pack_start(GTK_BOX(vbr_options_vbox), xing_header_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (xing_header_toggle, "toggled", (GCallback)
         toggle_xing, NULL);

        if (toggle_xing_val == 0)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (xing_header_toggle), TRUE);


        /* Add the Notebook */

        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbr_vbox,
                                 gtk_label_new(_("VBR/ABR")));


        /* Tags */

        tags_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(tags_vbox), 5);

        /* Frame Params */

        tags_frames_frame = gtk_frame_new(_("Frame params:"));
        gtk_container_set_border_width(GTK_CONTAINER(tags_frames_frame),
                                       5);
        gtk_box_pack_start(GTK_BOX(tags_vbox), tags_frames_frame, FALSE,
                           FALSE, 2);

        tags_frames_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(tags_frames_hbox), 5);
        gtk_container_add(GTK_CONTAINER(tags_frames_frame),
                          tags_frames_hbox);

        tags_copyright_toggle =
            gtk_check_button_new_with_label(_("Mark as copyright"));
        gtk_box_pack_start(GTK_BOX(tags_frames_hbox),
                           tags_copyright_toggle, FALSE, FALSE, 2);
        g_signal_connect (tags_copyright_toggle, "toggled", (GCallback)
         toggle_copyright, NULL);

        if (mark_copyright_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (tags_copyright_toggle), TRUE);

        tags_original_toggle =
            gtk_check_button_new_with_label(_("Mark as original"));
        gtk_box_pack_start(GTK_BOX(tags_frames_hbox), tags_original_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (tags_original_toggle, "toggled", (GCallback)
         toggle_original, NULL);

        if (mark_original_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (tags_original_toggle), TRUE);

        /* ID3 Params */

        tags_id3_frame = gtk_frame_new(_("ID3 params:"));
        gtk_container_set_border_width(GTK_CONTAINER(tags_id3_frame), 5);
        gtk_box_pack_start(GTK_BOX(tags_vbox), tags_id3_frame, FALSE,
                           FALSE, 2);

        tags_id3_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_set_border_width(GTK_CONTAINER(tags_id3_vbox), 5);
        gtk_container_add(GTK_CONTAINER(tags_id3_frame), tags_id3_vbox);

        tags_force_id3v2_toggle =
            gtk_check_button_new_with_label
            (_("Force addition of version 2 tag"));
        gtk_box_pack_start(GTK_BOX(tags_id3_vbox), tags_force_id3v2_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (tags_force_id3v2_toggle, "toggled", (GCallback)
         force_v2_toggle, NULL);

        tags_id3_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
        gtk_container_add(GTK_CONTAINER(tags_id3_vbox), tags_id3_hbox);

        tags_only_v1_toggle =
            gtk_check_button_new_with_label(_("Only add v1 tag"));
        gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v1_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (tags_only_v1_toggle, "toggled", (GCallback)
         id3_only_version, "v1");

        tags_only_v2_toggle =
            gtk_check_button_new_with_label(_("Only add v2 tag"));
        gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v2_toggle,
                           FALSE, FALSE, 2);
        g_signal_connect (tags_only_v2_toggle, "toggled", (GCallback)
         id3_only_version, "v2");

        if (force_v2_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (tags_force_id3v2_toggle), TRUE);

        if (only_v1_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (tags_only_v1_toggle), TRUE);

        if (only_v2_val == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                         (tags_only_v2_toggle), TRUE);

        /* Add the Notebook */

        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tags_vbox,
                                 gtk_label_new(_("Tags")));




        /* The Rest */

        /* Buttons */

        configure_bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
        gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox),
                                  GTK_BUTTONBOX_END);
        gtk_box_pack_start(GTK_BOX(vbox), configure_bbox, FALSE, FALSE, 0);

        configure_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
        g_signal_connect_swapped (configure_cancel, "clicked", (GCallback)
         gtk_widget_destroy, configure_win);
        gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel, TRUE,
                           TRUE, 0);

        configure_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
        g_signal_connect (configure_ok, "clicked", (GCallback) configure_ok_cb,
         NULL);
        gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok, TRUE,
                           TRUE, 0);
        gtk_widget_show(configure_ok);

        /* Set States */

        if (vbr_on == 1)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle),
                                         TRUE);
        else
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle),
                                         FALSE);

        /* Show it! */

        gtk_widget_show_all(configure_win);

    }
}
예제 #7
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;
}
GtkWidget*
create_Calculator (void)
{
  GtkWidget *Calculator;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *framebox;
  GtkWidget *alignment1;
  GtkWidget *table2;
  GtkWidget *hbox5;
  GtkWidget *heading;
  GtkWidget *labelDOO;
  GtkWidget *labelDuration;
  GtkWidget *hbox14;
  GtkWidget *label2;
  GtkWidget *hbox16;
  GtkWidget *label16;
  GtkWidget *entryCustom;
  GtkWidget *hbox21;
  GtkWidget *label14;
  GtkWidget *hbox18;
  GtkWidget *optionmenu2;
  GtkWidget *menu2;
  GtkWidget *avi1;
  GtkWidget *ogm1;
  GtkWidget *mpeg1;
  GtkWidget *hbox17;
  GtkWidget *optionmenu1;
  GtkWidget *menu1;
  GtkWidget *_1x80_cd1;
  GtkWidget *_2x80_cd1;
  GtkWidget *_1x74_cd1;
  GtkWidget *_2x74_cd1;
  GtkWidget *dvd1;
  GtkWidget *custom1;
  GtkWidget *hbox11;
  GtkWidget *hbox12;
  GtkWidget *hbox13;
  GtkWidget *label6;
  GtkWidget *entry3;
  GtkWidget *label7;
  GtkWidget *entry4;
  GtkWidget *hbox20;
  GtkWidget *table3;
  GtkWidget *label9;
  GtkWidget *labelAudio;
  GtkWidget *label11;
  GtkWidget *labelVideo;
  GtkWidget *label17;
  GtkWidget *labelTotal;
  GtkWidget *table4;
  GtkWidget *label12;
  GtkWidget *label15;
  GtkWidget *labelBitrate;
  GtkWidget *labelBPP;
  
  GtkWidget *dialog_action_area1;
  GtkWidget *doit;
  GtkWidget *button1;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  Calculator = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (Calculator), 6);
  gtk_window_set_title (GTK_WINDOW (Calculator), QT_TR_NOOP("Calculator"));
  gtk_window_set_resizable (GTK_WINDOW (Calculator), FALSE);
  gtk_dialog_set_has_separator (GTK_DIALOG (Calculator), FALSE);

  dialog_vbox1 = GTK_DIALOG (Calculator)->vbox;
  gtk_box_set_spacing (GTK_BOX(dialog_vbox1), 12);
  gtk_widget_show (dialog_vbox1);

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

  heading = gtk_label_new (QT_TR_NOOP("<b>Target</b>"));
  gtk_misc_set_alignment (GTK_MISC (heading), 0, 1);
  gtk_label_set_use_markup (GTK_LABEL (heading), TRUE);
  gtk_widget_show (heading);

  table2 = gtk_table_new (3, 4, FALSE);
  gtk_widget_show (table2);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 12);

  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment1);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 6, 0, 18, 0);
  gtk_container_add (GTK_CONTAINER (alignment1), table2);

  framebox = gtk_vbox_new (0, 0);
  gtk_box_pack_start (GTK_BOX(vbox1), framebox, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), heading, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), alignment1, FALSE, FALSE, 0);
  gtk_widget_show(framebox);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox5);
  gtk_table_attach (GTK_TABLE (table2), hbox5, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  labelDOO = gtk_label_new (QT_TR_NOOP("Duration:"));
  gtk_widget_show (labelDOO);
  gtk_box_pack_start (GTK_BOX (hbox5), labelDOO, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (labelDOO), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelDOO), 0, 0.5);

  labelDuration = gtk_label_new (QT_TR_NOOP("00:00:00"));
  gtk_widget_show (labelDuration);
  gtk_table_attach (GTK_TABLE (table2), labelDuration, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelDuration), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelDuration), 0, 0.5);

  hbox14 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox14);
  gtk_table_attach (GTK_TABLE (table2), hbox14, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  label2 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Medium:"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox14), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  hbox16 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox16);
  gtk_table_attach (GTK_TABLE (table2), hbox16, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  label16 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Format:"));
  gtk_widget_show (label16);
  gtk_box_pack_start (GTK_BOX (hbox16), label16, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label16), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label16), 0, 0.5);

  entryCustom = gtk_entry_new ();
  gtk_widget_show (entryCustom);
  gtk_table_attach (GTK_TABLE (table2), entryCustom, 3, 4, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, entryCustom, QT_TR_NOOP("Total size (custom)"), NULL);
  gtk_entry_set_max_length (GTK_ENTRY (entryCustom), 10);
  gtk_entry_set_width_chars (GTK_ENTRY (entryCustom), 6);

  hbox21 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox21);
  gtk_table_attach (GTK_TABLE (table2), hbox21, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  label14 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Custom size (MB):"));
  gtk_widget_show (label14);
  gtk_box_pack_start (GTK_BOX (hbox21), label14, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_LEFT);

  hbox18 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox18);
  gtk_table_attach (GTK_TABLE (table2), hbox18, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  optionmenu2 = gtk_option_menu_new ();
  gtk_widget_show (optionmenu2);
  gtk_box_pack_start (GTK_BOX (hbox18), optionmenu2, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, optionmenu2, QT_TR_NOOP("Output container format"), NULL);

  menu2 = gtk_menu_new ();

  avi1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("AVI"));
  gtk_widget_show (avi1);
  gtk_container_add (GTK_CONTAINER (menu2), avi1);

  ogm1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("OGM"));
  gtk_widget_show (ogm1);
  gtk_container_add (GTK_CONTAINER (menu2), ogm1);

  mpeg1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("MPEG"));
  gtk_widget_show (mpeg1);
  gtk_container_add (GTK_CONTAINER (menu2), mpeg1);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu2), menu2);

  hbox17 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox17);
  gtk_table_attach (GTK_TABLE (table2), hbox17, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  optionmenu1 = gtk_option_menu_new ();
  gtk_widget_show (optionmenu1);
  gtk_box_pack_start (GTK_BOX (hbox17), optionmenu1, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, optionmenu1, QT_TR_NOOP("Total size"), NULL);

  menu1 = gtk_menu_new ();

  _1x80_cd1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("1x 80 min. CD"));
  gtk_widget_show (_1x80_cd1);
  gtk_container_add (GTK_CONTAINER (menu1), _1x80_cd1);
  gtk_tooltips_set_tip (tooltips, _1x80_cd1, QT_TR_NOOP("Total size (custom)"), NULL);

  _2x80_cd1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("2x 80 min. CD"));
  gtk_widget_show (_2x80_cd1);
  gtk_container_add (GTK_CONTAINER (menu1), _2x80_cd1);

  _1x74_cd1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("1x 74 min. CD"));
  gtk_widget_show (_1x74_cd1);
  gtk_container_add (GTK_CONTAINER (menu1), _1x74_cd1);

  _2x74_cd1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("2x 74 min. CD"));
  gtk_widget_show (_2x74_cd1);
  gtk_container_add (GTK_CONTAINER (menu1), _2x74_cd1);

  dvd1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("DVD5"));
  gtk_widget_show (dvd1);
  gtk_container_add (GTK_CONTAINER (menu1), dvd1);

  custom1 = gtk_menu_item_new_with_mnemonic (QT_TR_NOOP("Custom"));
  gtk_widget_show (custom1);
  gtk_container_add (GTK_CONTAINER (menu1), custom1);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), menu1);

  hbox11 = gtk_hbox_new (TRUE, 12);
  gtk_widget_show (hbox11);

  hbox12 = gtk_hbox_new (FALSE, 12);
  gtk_box_pack_start (GTK_BOX (hbox11), hbox12, TRUE, TRUE, 0);
  gtk_widget_show (hbox12);
  label6 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Track _1:"));
  gtk_widget_show (label6);
  gtk_box_pack_start (GTK_BOX (hbox12), label6, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);

  entry3 = gtk_entry_new ();
  gtk_widget_show (entry3);
  gtk_box_pack_start (GTK_BOX (hbox12), entry3, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, entry3, QT_TR_NOOP("Audio bitrate in kb/s for track 1 (0 for no audio)"), NULL);
  gtk_entry_set_max_length (GTK_ENTRY (entry3), 10);
  gtk_entry_set_width_chars (GTK_ENTRY (entry3), 6);

  hbox13 = gtk_hbox_new (FALSE, 12);
  gtk_box_pack_start (GTK_BOX (hbox11), hbox13, TRUE, TRUE, 0);
  gtk_widget_show (hbox13);
  label7 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Track _2: "));
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox13), label7, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);

  entry4 = gtk_entry_new ();
  gtk_widget_show (entry4);
  gtk_box_pack_start (GTK_BOX (hbox13), entry4, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, entry4, QT_TR_NOOP("Audio bitrate in kb/s for track 2 (optional)"), NULL);
  gtk_entry_set_max_length (GTK_ENTRY (entry4), 10);
  gtk_entry_set_width_chars (GTK_ENTRY (entry4), 6);

  heading = gtk_label_new (QT_TR_NOOP("<b>Audio Bitrate</b>"));
  gtk_label_set_use_markup (GTK_LABEL (heading), TRUE);
  gtk_misc_set_alignment (GTK_MISC (heading), 0, 1);
  gtk_widget_show (heading);

  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment1);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 6, 0, 18, 0);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox11);

  framebox = gtk_vbox_new (0, 0);
  gtk_box_pack_start (GTK_BOX(vbox1), framebox, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), heading, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), alignment1, FALSE, FALSE, 0);
  gtk_widget_show(framebox);


  hbox20 = gtk_hbox_new (TRUE, 12);
  gtk_widget_show (hbox20);

  table3 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table3);
  gtk_box_pack_start (GTK_BOX (hbox20), table3, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 12);

  label9 = gtk_label_new (QT_TR_NOOP("Audio size (MB):"));
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);

  labelAudio = gtk_label_new (QT_TR_NOOP("0"));
  gtk_widget_show (labelAudio);
  gtk_table_attach (GTK_TABLE (table3), labelAudio, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelAudio), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelAudio), 0, 0.5);

  label11 = gtk_label_new (QT_TR_NOOP("Video size (MB):"));
  gtk_widget_show (label11);
  gtk_table_attach (GTK_TABLE (table3), label11, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);

  labelVideo = gtk_label_new (QT_TR_NOOP("0"));
  gtk_widget_show (labelVideo);
  gtk_table_attach (GTK_TABLE (table3), labelVideo, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelVideo), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelVideo), 0, 0.5);

  label17 = gtk_label_new (QT_TR_NOOP("Total size (MB):"));
  gtk_widget_show (label17);
  gtk_table_attach (GTK_TABLE (table3), label17, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label17), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label17), 0, 0.5);

  labelTotal = gtk_label_new (QT_TR_NOOP("0"));
  gtk_widget_show (labelTotal);
  gtk_table_attach (GTK_TABLE (table3), labelTotal, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelTotal), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelTotal), 0, 0.5);

  table4 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table4);
  gtk_box_pack_start (GTK_BOX (hbox20), table4, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table4), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table4), 6);

  label12 = gtk_label_new (QT_TR_NOOP("Video bitrate:"));
  gtk_widget_show (label12);
  gtk_table_attach (GTK_TABLE (table4), label12, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);

  label15 = gtk_label_new (QT_TR_NOOP("Bits per pixel:"));
  gtk_widget_show (label15);
  gtk_table_attach (GTK_TABLE (table4), label15, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label15), 0, 0.5);

  labelBitrate = gtk_label_new (QT_TR_NOOP("0"));
  gtk_widget_show (labelBitrate);
  gtk_table_attach (GTK_TABLE (table4), labelBitrate, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelBitrate), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelBitrate), 0, 0.5);

  labelBPP = gtk_label_new (QT_TR_NOOP("0.0"));
  gtk_widget_show (labelBPP);
  gtk_table_attach (GTK_TABLE (table4), labelBPP, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (labelBPP), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (labelBPP), 0, 0.5);

  heading = gtk_label_new (QT_TR_NOOP("<b>Result</b>"));
  gtk_misc_set_alignment (GTK_MISC (heading), 0, 1);
  gtk_label_set_use_markup (GTK_LABEL (heading), TRUE);
  gtk_widget_show (heading);

  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment1);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 6, 0, 18, 0);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox20);

  framebox = gtk_vbox_new (0, 0);
  gtk_box_pack_start (GTK_BOX(vbox1), framebox, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), heading, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(framebox), alignment1, FALSE, FALSE, 0);
  gtk_widget_show(framebox);

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

  doit = gtk_button_new_from_stock ("gtk-apply");
  gtk_widget_show (doit);
  gtk_dialog_add_action_widget (GTK_DIALOG (Calculator), doit, GTK_RESPONSE_APPLY);
  GTK_WIDGET_SET_FLAGS (doit, GTK_CAN_DEFAULT);

  button1 = gtk_button_new_from_stock ("gtk-close");
  gtk_widget_show (button1);
  gtk_dialog_add_action_widget (GTK_DIALOG (Calculator), button1, GTK_RESPONSE_CLOSE);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label2), optionmenu1);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label16), optionmenu2);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label14), entryCustom);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label6), entry3);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label7), entry4);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (Calculator, Calculator, "Calculator");
  GLADE_HOOKUP_OBJECT_NO_REF (Calculator, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (Calculator, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (Calculator, framebox, "framebox");
  GLADE_HOOKUP_OBJECT (Calculator, alignment1, "alignment1");
  GLADE_HOOKUP_OBJECT (Calculator, table2, "table2");
  GLADE_HOOKUP_OBJECT (Calculator, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (Calculator, heading, "heading");
  GLADE_HOOKUP_OBJECT (Calculator, labelDOO, "labelDOO");
  GLADE_HOOKUP_OBJECT (Calculator, labelDuration, "labelDuration");
  GLADE_HOOKUP_OBJECT (Calculator, hbox14, "hbox14");
  GLADE_HOOKUP_OBJECT (Calculator, label2, "label2");
  GLADE_HOOKUP_OBJECT (Calculator, hbox16, "hbox16");
  GLADE_HOOKUP_OBJECT (Calculator, label16, "label16");
  GLADE_HOOKUP_OBJECT (Calculator, entryCustom, "entryCustom");
  GLADE_HOOKUP_OBJECT (Calculator, hbox21, "hbox21");
  GLADE_HOOKUP_OBJECT (Calculator, label14, "label14");
  GLADE_HOOKUP_OBJECT (Calculator, hbox18, "hbox18");
  GLADE_HOOKUP_OBJECT (Calculator, optionmenu2, "optionmenu2");
  GLADE_HOOKUP_OBJECT (Calculator, menu2, "menu2");
  GLADE_HOOKUP_OBJECT (Calculator, avi1, "avi1");
  GLADE_HOOKUP_OBJECT (Calculator, ogm1, "ogm1");
  GLADE_HOOKUP_OBJECT (Calculator, mpeg1, "mpeg1");
  GLADE_HOOKUP_OBJECT (Calculator, hbox17, "hbox17");
  GLADE_HOOKUP_OBJECT (Calculator, optionmenu1, "optionmenu1");
  GLADE_HOOKUP_OBJECT (Calculator, menu1, "menu1");
  GLADE_HOOKUP_OBJECT (Calculator, _1x80_cd1, "_1x80_cd1");
  GLADE_HOOKUP_OBJECT (Calculator, _2x80_cd1, "_2x80_cd1");
  GLADE_HOOKUP_OBJECT (Calculator, _1x74_cd1, "_1x74_cd1");
  GLADE_HOOKUP_OBJECT (Calculator, _2x74_cd1, "_2x74_cd1");
  GLADE_HOOKUP_OBJECT (Calculator, dvd1, "dvd1");
  GLADE_HOOKUP_OBJECT (Calculator, custom1, "custom1");
  GLADE_HOOKUP_OBJECT (Calculator, hbox11, "hbox11");
  GLADE_HOOKUP_OBJECT (Calculator, hbox12, "hbox12");
  GLADE_HOOKUP_OBJECT (Calculator, hbox13, "hbox13");
  GLADE_HOOKUP_OBJECT (Calculator, label6, "label6");
  GLADE_HOOKUP_OBJECT (Calculator, entry3, "entry3");
  GLADE_HOOKUP_OBJECT (Calculator, label7, "label7");
  GLADE_HOOKUP_OBJECT (Calculator, entry4, "entry4");
  GLADE_HOOKUP_OBJECT (Calculator, hbox20, "hbox20");
  GLADE_HOOKUP_OBJECT (Calculator, table3, "table3");
  GLADE_HOOKUP_OBJECT (Calculator, label9, "label9");
  GLADE_HOOKUP_OBJECT (Calculator, labelAudio, "labelAudio");
  GLADE_HOOKUP_OBJECT (Calculator, label11, "label11");
  GLADE_HOOKUP_OBJECT (Calculator, labelVideo, "labelVideo");
  GLADE_HOOKUP_OBJECT (Calculator, label17, "label17");
  GLADE_HOOKUP_OBJECT (Calculator, labelTotal, "labelTotal");
  GLADE_HOOKUP_OBJECT (Calculator, table4, "table4");
  GLADE_HOOKUP_OBJECT (Calculator, label12, "label12");
  GLADE_HOOKUP_OBJECT (Calculator, label15, "label15");
  GLADE_HOOKUP_OBJECT (Calculator, labelBitrate, "labelBitrate");
  GLADE_HOOKUP_OBJECT (Calculator, labelBPP, "labelBPP");
  
  GLADE_HOOKUP_OBJECT_NO_REF (Calculator, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (Calculator, doit, "doit");
  GLADE_HOOKUP_OBJECT (Calculator, button1, "button1");
  GLADE_HOOKUP_OBJECT_NO_REF (Calculator, tooltips, "tooltips");

  gtk_widget_grab_focus (entry3);
  return Calculator;
}
예제 #9
0
int main(int argc, char **argv)
{
#if WIN32
  init_TableDir();
#endif

  gtk_init (&argc, &argv);

#if GCIN_i18n_message
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);
#endif

  b_pinyin = is_pinyin_kbm();

  pho_load();

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(mainwin), FALSE);
  gtk_window_set_default_size(GTK_WINDOW (mainwin), 640, 220);
  set_window_gcin_icon(mainwin);

  GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER(mainwin), vbox_top);

  GtkWidget *view = gtk_text_view_new ();
  gtk_widget_set_hexpand (view, TRUE);
  gtk_widget_set_vexpand (view, TRUE);
  gtk_container_add (GTK_CONTAINER(sw), view);

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

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

  gtk_text_buffer_create_tag (buffer,
     "blue_background", "background", "blue", "foreground", "white", NULL);

  gtk_text_buffer_create_tag (buffer, "char_wrap",
			      "wrap_mode", GTK_WRAP_CHAR, NULL);

  hbox_buttons = gtk_hbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_buttons, FALSE, FALSE, 0);

  GtkWidget *button_fetch = gtk_button_new_with_label(_(_L("自剪貼區更新")));
  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_fetch, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_fetch), "clicked",
     G_CALLBACK (cb_button_fetch), NULL);

  GtkWidget *button_exit = gtk_button_new_from_stock(GTK_STOCK_QUIT);
  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_exit, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_exit), "clicked",
     G_CALLBACK (do_exit), NULL);


  g_signal_connect (G_OBJECT (mainwin), "delete_event",
                    G_CALLBACK (do_exit), NULL);

  gtk_widget_show_all(mainwin);
#if UNIX
  pclipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
#else
  pclipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
#endif

  req_clipboard();

  gtk_main();
  return 0;
}
예제 #10
0
파일: textgui.c 프로젝트: 94m3k1n9/hexchat
void
pevent_dialog_show ()
{
	GtkWidget *vbox, *hbox, *tbox, *wid, *bh, *th;
	GtkListStore *store, *hstore;
	GtkTreeSelection *sel;

	if (pevent_dialog)
	{
		mg_bring_tofront (pevent_dialog);
		return;
	}

	pevent_dialog =
			  mg_create_generic_tab ("edit events", _("Edit Events"),
											 TRUE, FALSE, pevent_dialog_close, NULL,
											 600, 455, &vbox, 0);

	wid = gtk_vpaned_new ();
	th = gtk_vbox_new (0, 2);
	bh = gtk_vbox_new (0, 2);
	gtk_widget_show (th);
	gtk_widget_show (bh);
	gtk_paned_pack1 (GTK_PANED (wid), th, 1, 1);
	gtk_paned_pack2 (GTK_PANED (wid), bh, 0, 1);
	gtk_box_pack_start (GTK_BOX (vbox), wid, 1, 1, 0);
	gtk_widget_show (wid);

	store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING,
	                            G_TYPE_STRING, G_TYPE_INT);
	pevent_dialog_list = gtkutil_treeview_new (th, GTK_TREE_MODEL (store), NULL,
															 COL_EVENT_NAME, _("Event"),
															 COL_EVENT_TEXT, _("Text"), -1);
	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (pevent_dialog_list));
	g_signal_connect (G_OBJECT (sel), "changed",
							G_CALLBACK (pevent_dialog_select), store);

	pevent_dialog_twid = gtk_xtext_new (colors, 0);
	gtk_xtext_set_tint (GTK_XTEXT (pevent_dialog_twid), prefs.hex_text_tint_red, prefs.hex_text_tint_green, prefs.hex_text_tint_blue);
	gtk_xtext_set_background (GTK_XTEXT (pevent_dialog_twid),
									  channelwin_pix, prefs.hex_text_transparent);

	pevent_dialog_entry = gtk_entry_new_with_max_length (255);
	g_signal_connect (G_OBJECT (pevent_dialog_entry), "activate",
							G_CALLBACK (pevent_dialog_update), pevent_dialog_twid);
	gtk_box_pack_start (GTK_BOX (bh), pevent_dialog_entry, 0, 0, 0);
	gtk_widget_show (pevent_dialog_entry);

	tbox = gtk_hbox_new (0, 0);
	gtk_container_add (GTK_CONTAINER (bh), tbox);
	gtk_widget_show (tbox);

	gtk_widget_set_usize (pevent_dialog_twid, 150, 20);
	gtk_container_add (GTK_CONTAINER (tbox), pevent_dialog_twid);
	gtk_xtext_set_font (GTK_XTEXT (pevent_dialog_twid), prefs.hex_text_font);

	wid = gtk_vscrollbar_new (GTK_XTEXT (pevent_dialog_twid)->adj);
	gtk_box_pack_start (GTK_BOX (tbox), wid, FALSE, FALSE, 0);
	show_and_unfocus (wid);

	gtk_widget_show (pevent_dialog_twid);

	hstore = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
	pevent_dialog_hlist = gtkutil_treeview_new (bh, GTK_TREE_MODEL (hstore),
															  NULL,
															  0, _("$ Number"),
															  1, _("Description"), -1);
	gtk_widget_show (pevent_dialog_hlist);

	pevent_dialog_fill (pevent_dialog_list);
	gtk_widget_show (pevent_dialog_list);

	hbox = gtk_hbutton_box_new ();
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 2);
	/*wid = gtk_button_new_with_label (_("Save"));
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	gtk_signal_connect (GTK_OBJECT (wid), "clicked",
							  GTK_SIGNAL_FUNC (pevent_save_cb), NULL);
	gtk_widget_show (wid);*/
	gtkutil_button (hbox, GTK_STOCK_SAVE_AS, NULL, pevent_save_cb,
						 (void *) 1, _("Save As..."));
	gtkutil_button (hbox, GTK_STOCK_OPEN, NULL, pevent_load_cb,
						 (void *) 0, _("Load From..."));
	wid = gtk_button_new_with_label (_("Test All"));
	gtk_box_pack_end (GTK_BOX (hbox), wid, 0, 0, 0);
	g_signal_connect (G_OBJECT (wid), "clicked",
							G_CALLBACK (pevent_test_cb), pevent_dialog_twid);
	gtk_widget_show (wid);

	wid = gtk_button_new_from_stock (GTK_STOCK_OK);
	gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
	g_signal_connect (G_OBJECT (wid), "clicked",
							G_CALLBACK (pevent_ok_cb), NULL);
	gtk_widget_show (wid);

	gtk_widget_show (hbox);

	gtk_widget_show (pevent_dialog);
}
예제 #11
0
파일: clipboard.c 프로젝트: Aridna/gtk2
GtkWidget *
do_clipboard (GtkWidget *do_widget)
{
  if (!window)
    {
      GtkWidget *vbox, *hbox;
      GtkWidget *label;
      GtkWidget *entry, *button;
      GtkWidget *ebox, *image;
      GtkClipboard *clipboard;

      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_screen (GTK_WINDOW (window),
                             gtk_widget_get_screen (do_widget));
      gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo");

      g_signal_connect (window, "destroy",
                        G_CALLBACK (gtk_widget_destroyed), &window);

      vbox = gtk_vbox_new (FALSE, 0);
      gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);

      gtk_container_add (GTK_CONTAINER (window), vbox);

      label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");

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

      hbox = gtk_hbox_new (FALSE, 4);
      gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

      /* Create the first entry */
      entry = gtk_entry_new ();
      gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);

      /* Create the button */
      button = gtk_button_new_from_stock (GTK_STOCK_COPY);
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      g_signal_connect (button, "clicked",
                        G_CALLBACK (copy_button_clicked), entry);

      label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

      hbox = gtk_hbox_new (FALSE, 4);
      gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

      /* Create the second entry */
      entry = gtk_entry_new ();
      gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);

      /* Create the button */
      button = gtk_button_new_from_stock (GTK_STOCK_PASTE);
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
      g_signal_connect (button, "clicked",
                        G_CALLBACK (paste_button_clicked), entry);

      label = gtk_label_new ("Images can be transferred via the clipboard, too");
      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

      hbox = gtk_hbox_new (FALSE, 4);
      gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

      /* Create the first image */
      image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
                                        GTK_ICON_SIZE_BUTTON);
      ebox = gtk_event_box_new ();
      gtk_container_add (GTK_CONTAINER (ebox), image);
      gtk_container_add (GTK_CONTAINER (hbox), ebox);

      /* make ebox a drag source */
      gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
      gtk_drag_source_add_image_targets (ebox);
      g_signal_connect (ebox, "drag-begin",
                        G_CALLBACK (drag_begin), image);
      g_signal_connect (ebox, "drag-data-get",
                        G_CALLBACK (drag_data_get), image);

      /* accept drops on ebox */
      gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
                         NULL, 0, GDK_ACTION_COPY);
      gtk_drag_dest_add_image_targets (ebox);
      g_signal_connect (ebox, "drag-data-received",
                        G_CALLBACK (drag_data_received), image);

      /* context menu on ebox */
      g_signal_connect (ebox, "button-press-event",
                        G_CALLBACK (button_press), image);

      /* Create the second image */
      image = gtk_image_new_from_stock (GTK_STOCK_STOP,
                                        GTK_ICON_SIZE_BUTTON);
      ebox = gtk_event_box_new ();
      gtk_container_add (GTK_CONTAINER (ebox), image);
      gtk_container_add (GTK_CONTAINER (hbox), ebox);

      /* make ebox a drag source */
      gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
      gtk_drag_source_add_image_targets (ebox);
      g_signal_connect (ebox, "drag-begin",
                        G_CALLBACK (drag_begin), image);
      g_signal_connect (ebox, "drag-data-get",
                        G_CALLBACK (drag_data_get), image);

      /* accept drops on ebox */
      gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
                         NULL, 0, GDK_ACTION_COPY);
      gtk_drag_dest_add_image_targets (ebox);
      g_signal_connect (ebox, "drag-data-received",
                        G_CALLBACK (drag_data_received), image);

      /* context menu on ebox */
      g_signal_connect (ebox, "button-press-event",
                        G_CALLBACK (button_press), image);

      /* tell the clipboard manager to make the data persistent */
      clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
      gtk_clipboard_set_can_store (clipboard, NULL, 0);
    }

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

  return window;
}
예제 #12
0
GtkWidget*
create_Config (void)
{
  GtkWidget *Config;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *GtkEntry_Iso;
  GtkWidget *button5;
  GtkWidget *hbox2;
  GtkWidget *GtkProgressBar_Progress;
  GtkWidget *button6;
  GtkWidget *hbox4;
  GtkWidget *label2;
  GtkWidget *GtkCombo_Method;
  GList *GtkCombo_Method_items = NULL;
  GtkWidget *combo_entry1;
  GtkWidget *hbuttonbox2;
  GtkWidget *GtkButton_Compress;
  GtkWidget *GtkButton_Decompress;
  GtkWidget *hbox3;
  GtkWidget *label1;
  GtkWidget *GtkEntry_CdDev;
  GtkWidget *hbuttonbox3;
  GtkWidget *GtkButton_Create;
  GtkWidget *GtkButton_CreateZ;
  GtkWidget *checkBlockDump;
  GtkWidget *hbuttonbox1;
  GtkWidget *button1;
  GtkWidget *button2;

  Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
  gtk_window_set_title (GTK_WINDOW (Config), _("CDVD Config Dialog"));

  vbox1 = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (Config), vbox1);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);

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

  GtkEntry_Iso = gtk_entry_new ();
  gtk_widget_show (GtkEntry_Iso);
  gtk_box_pack_start (GTK_BOX (hbox1), GtkEntry_Iso, TRUE, TRUE, 0);

  button5 = gtk_button_new_with_mnemonic (_("Select Iso"));
  gtk_widget_show (button5);
  gtk_box_pack_start (GTK_BOX (hbox1), button5, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 10);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);

  GtkProgressBar_Progress = gtk_progress_bar_new ();
  gtk_widget_show (GtkProgressBar_Progress);
  gtk_box_pack_start (GTK_BOX (hbox2), GtkProgressBar_Progress, TRUE, FALSE, 0);

  button6 = gtk_button_new_with_mnemonic (_("Stop"));
  gtk_widget_show (button6);
  gtk_box_pack_end (GTK_BOX (hbox2), button6, FALSE, FALSE, 0);

  hbox4 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox4, TRUE, TRUE, 0);

  label2 = gtk_label_new (_("Compression Method:"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox4), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);

  GtkCombo_Method = gtk_combo_new ();
  g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Method)->popwin),
                     "GladeParentKey", GtkCombo_Method);
  gtk_widget_show (GtkCombo_Method);
  gtk_box_pack_start (GTK_BOX (hbox4), GtkCombo_Method, TRUE, FALSE, 0);
  GtkCombo_Method_items = g_list_append (GtkCombo_Method_items, (gpointer) "");
  gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Method), GtkCombo_Method_items);
  g_list_free (GtkCombo_Method_items);

  combo_entry1 = GTK_COMBO (GtkCombo_Method)->entry;
  gtk_widget_show (combo_entry1);

  hbuttonbox2 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox2, TRUE, TRUE, 0);

  GtkButton_Compress = gtk_button_new_with_mnemonic (_("Compress Iso"));
  gtk_widget_show (GtkButton_Compress);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Compress);
  GTK_WIDGET_SET_FLAGS (GtkButton_Compress, GTK_CAN_DEFAULT);

  GtkButton_Decompress = gtk_button_new_with_mnemonic (_("Decompress Iso"));
  gtk_widget_show (GtkButton_Decompress);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Decompress);
  GTK_WIDGET_SET_FLAGS (GtkButton_Decompress, GTK_CAN_DEFAULT);

  hbox3 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox3);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox3, FALSE, FALSE, 0);

  label1 = gtk_label_new (_("Cdrom Device: "));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox3), label1, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER);

  GtkEntry_CdDev = gtk_entry_new ();
  gtk_widget_show (GtkEntry_CdDev);
  gtk_box_pack_start (GTK_BOX (hbox3), GtkEntry_CdDev, TRUE, TRUE, 0);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, TRUE, TRUE, 0);

  GtkButton_Create = gtk_button_new_with_mnemonic (_("Create Iso"));
  gtk_widget_show (GtkButton_Create);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_Create);
  GTK_WIDGET_SET_FLAGS (GtkButton_Create, GTK_CAN_DEFAULT);

  GtkButton_CreateZ = gtk_button_new_with_mnemonic (_("Create Compressed Iso"));
  gtk_widget_show (GtkButton_CreateZ);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_CreateZ);
  GTK_WIDGET_SET_FLAGS (GtkButton_CreateZ, GTK_CAN_DEFAULT);

  checkBlockDump = gtk_check_button_new_with_mnemonic (_("Create a dump of the running iso"));
  gtk_widget_show (checkBlockDump);
  gtk_box_pack_start (GTK_BOX (vbox1), checkBlockDump, FALSE, FALSE, 0);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0);

  button1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (button1);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);

  button2 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (button2);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2);
  GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) button5, "clicked",
                    G_CALLBACK (OnFileSel),
                    NULL);
  g_signal_connect ((gpointer) button6, "clicked",
                    G_CALLBACK (OnStop),
                    NULL);
  g_signal_connect ((gpointer) GtkButton_Compress, "clicked",
                    G_CALLBACK (OnCompress),
                    NULL);
  g_signal_connect ((gpointer) GtkButton_Decompress, "clicked",
                    G_CALLBACK (OnDecompress),
                    NULL);
  g_signal_connect ((gpointer) GtkButton_Create, "clicked",
                    G_CALLBACK (OnCreate),
                    NULL);
  g_signal_connect ((gpointer) GtkButton_CreateZ, "clicked",
                    G_CALLBACK (OnCreateZ),
                    NULL);
  g_signal_connect ((gpointer) button1, "clicked",
                    G_CALLBACK (OnOk),
                    NULL);
  g_signal_connect ((gpointer) button2, "clicked",
                    G_CALLBACK (OnCancel),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config");
  GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (Config, GtkEntry_Iso, "GtkEntry_Iso");
  GLADE_HOOKUP_OBJECT (Config, button5, "button5");
  GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (Config, GtkProgressBar_Progress, "GtkProgressBar_Progress");
  GLADE_HOOKUP_OBJECT (Config, button6, "button6");
  GLADE_HOOKUP_OBJECT (Config, hbox4, "hbox4");
  GLADE_HOOKUP_OBJECT (Config, label2, "label2");
  GLADE_HOOKUP_OBJECT (Config, GtkCombo_Method, "GtkCombo_Method");
  GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1");
  GLADE_HOOKUP_OBJECT (Config, hbuttonbox2, "hbuttonbox2");
  GLADE_HOOKUP_OBJECT (Config, GtkButton_Compress, "GtkButton_Compress");
  GLADE_HOOKUP_OBJECT (Config, GtkButton_Decompress, "GtkButton_Decompress");
  GLADE_HOOKUP_OBJECT (Config, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (Config, label1, "label1");
  GLADE_HOOKUP_OBJECT (Config, GtkEntry_CdDev, "GtkEntry_CdDev");
  GLADE_HOOKUP_OBJECT (Config, hbuttonbox3, "hbuttonbox3");
  GLADE_HOOKUP_OBJECT (Config, GtkButton_Create, "GtkButton_Create");
  GLADE_HOOKUP_OBJECT (Config, GtkButton_CreateZ, "GtkButton_CreateZ");
  GLADE_HOOKUP_OBJECT (Config, checkBlockDump, "checkBlockDump");
  GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1");
  GLADE_HOOKUP_OBJECT (Config, button1, "button1");
  GLADE_HOOKUP_OBJECT (Config, button2, "button2");

  return Config;
}
GtkWidget*
create_dialog1 (void)
{
    GtkWidget *dialog1;
    GtkWidget *dialog_vbox1;
    GtkWidget *vbox1;
    GtkWidget *hbox2;
    GtkWidget *curve1;
    GtkWidget *vseparator1;
    GtkWidget *vbox3;
    GtkWidget *drawingarea_histin;
    GtkWidget *drawingarea_histout;
    GtkWidget *hbox1;
    GtkWidget *buttonReset;
    GtkWidget *buttonCancel;
    GtkWidget *buttonApply;
    GtkWidget *button3;
    GtkWidget *gui_scale;
    GtkWidget *drawingarea1;
    GtkWidget *dialog_action_area1;

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

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

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

    hbox2 = gtk_hbox_new (FALSE, 0);
    gtk_widget_show (hbox2);
    gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0);

    curve1 = gtk_curve_new ();
    gtk_widget_show (curve1);
    gtk_box_pack_start (GTK_BOX (hbox2), curve1, FALSE, FALSE, 0);
    gtk_curve_set_range (GTK_CURVE (curve1), 0, 1, 0, 1);

    vseparator1 = gtk_vseparator_new ();
    gtk_widget_show (vseparator1);
    gtk_box_pack_start (GTK_BOX (hbox2), vseparator1, FALSE, FALSE, 0);

    vbox3 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox3);
    gtk_box_pack_start (GTK_BOX (hbox2), vbox3, TRUE, TRUE, 0);

    drawingarea_histin = gtk_drawing_area_new ();
    gtk_widget_show (drawingarea_histin);
    gtk_box_pack_start (GTK_BOX (vbox3), drawingarea_histin, TRUE, TRUE, 0);
    gtk_widget_set_size_request (drawingarea_histin, 10, -1);

    drawingarea_histout = gtk_drawing_area_new ();
    gtk_widget_show (drawingarea_histout);
    gtk_box_pack_start (GTK_BOX (vbox3), drawingarea_histout, TRUE, TRUE, 0);

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

    buttonReset = gtk_button_new_from_stock ("gtk-clear");
    gtk_widget_show (buttonReset);
    gtk_box_pack_start (GTK_BOX (hbox1), buttonReset, FALSE, FALSE, 0);

    buttonCancel = gtk_button_new_from_stock ("gtk-cancel");
    gtk_widget_show (buttonCancel);
    gtk_box_pack_start (GTK_BOX (hbox1), buttonCancel, FALSE, FALSE, 0);

    buttonApply = gtk_button_new_from_stock ("gtk-apply");
    gtk_widget_show (buttonApply);
    gtk_box_pack_start (GTK_BOX (hbox1), buttonApply, FALSE, FALSE, 0);

    button3 = gtk_button_new_from_stock ("gtk-ok");
    gtk_widget_show (button3);
    gtk_box_pack_start (GTK_BOX (hbox1), button3, FALSE, FALSE, 0);

    gui_scale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 10, 10)));
    gtk_widget_show (gui_scale);
    gtk_box_pack_start (GTK_BOX (vbox1), gui_scale, TRUE, TRUE, 0);

    drawingarea1 = gtk_drawing_area_new ();
    gtk_widget_show (drawingarea1);
    gtk_box_pack_start (GTK_BOX (dialog_vbox1), drawingarea1, TRUE, TRUE, 0);
    gtk_widget_set_size_request (drawingarea1, 100, 100);

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

    /* 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, vbox1, "vbox1");
    GLADE_HOOKUP_OBJECT (dialog1, hbox2, "hbox2");
    GLADE_HOOKUP_OBJECT (dialog1, curve1, "curve1");
    GLADE_HOOKUP_OBJECT (dialog1, vseparator1, "vseparator1");
    GLADE_HOOKUP_OBJECT (dialog1, vbox3, "vbox3");
    GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histin, "drawingarea_histin");
    GLADE_HOOKUP_OBJECT (dialog1, drawingarea_histout, "drawingarea_histout");
    GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
    GLADE_HOOKUP_OBJECT (dialog1, buttonReset, "buttonReset");
    GLADE_HOOKUP_OBJECT (dialog1, buttonCancel, "buttonCancel");
    GLADE_HOOKUP_OBJECT (dialog1, buttonApply, "buttonApply");
    GLADE_HOOKUP_OBJECT (dialog1, button3, "button3");
    GLADE_HOOKUP_OBJECT (dialog1, gui_scale, "gui_scale");
    GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
    GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");

    //gtk_widget_grab_default (buttonApply);
    return dialog1;
}
예제 #14
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *frame1;
  GtkWidget *scrolledwindow1;
  GtkWidget *textview1;
  GtkWidget *label1;
  GtkWidget *dialog_action_area1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("dialog1"));

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

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame1, TRUE, TRUE, 0);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_container_add (GTK_CONTAINER (frame1), scrolledwindow1);

  textview1 = gtk_text_view_new ();
  gtk_widget_show (textview1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), textview1);

  label1 = gtk_label_new (_("label1"));
  gtk_widget_show (label1);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label1);

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

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

  g_signal_connect ((gpointer) dialog1, "delete_event",
                    G_CALLBACK (dlg_delete),
                    NULL);
  g_signal_connect ((gpointer) okbutton1, "clicked",
                    G_CALLBACK (dlg_delete),
                    NULL);

  /* 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, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (dialog1, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (dialog1, textview1, "textview1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
예제 #15
0
gboolean edit_bookmarks( GtkWindow* parent )
{
    GList* l;
    GtkWidget* dlg;
    GtkWidget* btn_box;
    GtkWidget* add_btn;
    GtkWidget* delete_btn;
    GtkWidget* scroll;
    GtkWidget* list_view;
    GtkListStore* list;
    GtkTreeViewColumn* col;
    GtkTreeIter it;
    GtkTreeSelection* sel;
    gchar *name, *path, *item;
    gboolean ret = FALSE;
    PtkBookmarks* bookmarks;
    GtkCellRenderer *renderer, *icon_renderer;
    GdkPixbuf* icon;

    dlg = gtk_dialog_new_with_buttons ( _("Edit Bookmarks"),
                                        parent,
                                        GTK_DIALOG_MODAL,
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                        GTK_STOCK_OK, GTK_RESPONSE_OK,
                                        NULL );
    gtk_dialog_set_alternative_button_order( GTK_DIALOG(dlg), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1 );

    list = gtk_list_store_new( NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING );

    icon = gtk_icon_theme_load_icon( gtk_icon_theme_get_default(),
                                     "gnome-fs-directory",
                                     20, 0, NULL );
    bookmarks = ptk_bookmarks_get();
    for( l = bookmarks->list; l; l = l->next )
    {
        gtk_list_store_append( list, &it );
        gtk_list_store_set( list, &it,
                            COL_ICON, icon,
                            COL_NAME, l->data,
                            COL_DIRPATH, ptk_bookmarks_item_get_path((char*)l->data),
                            -1);
    }
    if( icon )
        g_object_unref( icon );

    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scroll),
                                         GTK_SHADOW_IN);

    list_view = gtk_tree_view_new_with_model( GTK_TREE_MODEL(list) );
    g_object_set_data( G_OBJECT(dlg), "list_view", list_view );

    sel = gtk_tree_view_get_selection( GTK_TREE_VIEW(list_view) );
    gtk_tree_selection_set_mode( sel, GTK_SELECTION_BROWSE );

    if( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL(list), &it ) )
    {
        gtk_tree_selection_select_iter( sel, &it );
    }

    icon_renderer = gtk_cell_renderer_pixbuf_new();
    renderer = gtk_cell_renderer_text_new();
    g_object_set( G_OBJECT(renderer), "editable", TRUE, NULL );
    g_signal_connect( renderer, "edited", G_CALLBACK(on_name_edited), list );
    col = gtk_tree_view_column_new_with_attributes(NULL, icon_renderer, "pixbuf", COL_ICON, NULL );
    gtk_tree_view_append_column( GTK_TREE_VIEW(list_view), col );

    col = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, "text", COL_NAME, NULL);
    gtk_tree_view_column_set_resizable(col, TRUE);
    gtk_tree_view_column_set_fixed_width(col, 160);
    gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_FIXED);
    gtk_tree_view_append_column( GTK_TREE_VIEW(list_view), col );

    renderer = gtk_cell_renderer_text_new();
    g_object_set( G_OBJECT(renderer), "editable", TRUE, NULL );
    g_signal_connect( renderer, "edited", G_CALLBACK(on_path_edited), list );
    col = gtk_tree_view_column_new_with_attributes(_("Path"),
                                                   renderer, "text", COL_DIRPATH, NULL);
    gtk_tree_view_column_set_resizable(col, TRUE);
    gtk_tree_view_append_column( GTK_TREE_VIEW(list_view), col );

    gtk_tree_view_set_reorderable ( GTK_TREE_VIEW(list_view), TRUE );

    gtk_container_add( GTK_CONTAINER(scroll), list_view);

    btn_box = gtk_hbutton_box_new();
    gtk_button_box_set_layout ( GTK_BUTTON_BOX(btn_box), GTK_BUTTONBOX_START );
    add_btn = gtk_button_new_from_stock ( GTK_STOCK_ADD );
    g_signal_connect( add_btn, "clicked", G_CALLBACK(on_add), dlg );
    gtk_box_pack_start ( GTK_BOX(btn_box), add_btn, TRUE, TRUE, 0 );

    delete_btn = gtk_button_new_from_stock ( GTK_STOCK_DELETE );
    g_signal_connect( delete_btn, "clicked", G_CALLBACK(on_delete), dlg );
    gtk_box_pack_start ( GTK_BOX(btn_box), delete_btn, TRUE, TRUE, 0 );

    gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area ( GTK_DIALOG(dlg) )), btn_box,
                        FALSE, FALSE, 4 );
    gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area ( GTK_DIALOG(dlg) )), scroll, TRUE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area ( GTK_DIALOG(dlg) )),
                        gtk_label_new(_("Use drag & drop to sort the items")),
                        FALSE, FALSE, 4 );

    gtk_window_set_default_size ( GTK_WINDOW(dlg), 480, 400 );

    gtk_widget_show_all( dlg );
    gtk_widget_grab_focus( list_view );

    pcmanfm_ref();

    if( gtk_dialog_run( GTK_DIALOG(dlg) ) == GTK_RESPONSE_OK )
    {
        l = NULL;
        if( gtk_tree_model_get_iter_first( GTK_TREE_MODEL(list), &it ) )
        {
            do
            {
                gtk_tree_model_get( GTK_TREE_MODEL(list), &it,
                                    COL_NAME, &name,
                                    COL_DIRPATH, &path,
                                    -1 );
                if( ! name )
                    name = g_path_get_basename( path );
                item = ptk_bookmarks_item_new( name, strlen(name),
                                               path ? path : "", path ? strlen(path) : 0 );
                l = g_list_append( l, item );
                g_free(name);
                g_free(path);
            }
            while( gtk_tree_model_iter_next( GTK_TREE_MODEL(list), &it) );
        }

        ptk_bookmarks_set( l );

        ret = TRUE;
    }

    ptk_bookmarks_unref();

    gtk_widget_destroy( dlg );
    pcmanfm_unref();

    return ret;
}
예제 #16
0
int main(int argc, char **argv)
{
  init_TableDir();
  set_is_chs();
  b_pinyin = is_pinyin_kbm();

  gtk_init (&argc, &argv);
  load_setttings();
  load_gtab_list(TRUE);


#if HIME_i18n_message
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);
#endif

  pinmd = &inmd[default_input_method];

  if (pinmd->method_type == method_type_TSIN) {
    dbg("is tsin\n");
    pho_load();
    load_tsin_db();
    ph_key_sz = 2;
  } else
  if (pinmd->filename) {
    dbg("gtab filename %s\n", pinmd->filename);
    init_gtab(default_input_method);
    is_gtab = TRUE;
    init_tsin_table_fname(pinmd, gtab_tsin_fname);
    load_tsin_db0(gtab_tsin_fname, TRUE);
  } else
    p_err("Your default input method %s doesn't use phrase database",
      pinmd->cname);

  dbg("ph_key_sz: %d\n", ph_key_sz);

  dpy = GDK_DISPLAY();

  mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(mainwin), FALSE);
  gtk_window_set_default_size(GTK_WINDOW (mainwin), 640, 520);
  set_window_hime_icon(mainwin);

  GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER(mainwin), vbox_top);

  GtkWidget *view = gtk_text_view_new ();
  gtk_widget_set_hexpand (view, TRUE);
  gtk_widget_set_vexpand (view, TRUE);
  gtk_container_add (GTK_CONTAINER(sw), view);

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

  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

  char *text = _("按滑鼠中鍵, 貼上你要 hime-tslearn 學習的文章。");

  gtk_text_buffer_set_text (buffer, text, -1);

  gtk_text_buffer_create_tag (buffer,
     "blue_background", "background", "blue", "foreground", "white", NULL);

  gtk_text_buffer_create_tag (buffer, "char_wrap",
			      "wrap_mode", GTK_WRAP_CHAR, NULL);

  hbox_buttons = gtk_hbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_buttons, FALSE, FALSE, 0);

  GtkWidget *button_parse = gtk_button_new_with_label(_("標示已知詞"));
  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_parse, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_parse), "clicked",
     G_CALLBACK (cb_button_parse), NULL);

  GtkWidget *button_add = gtk_button_new_with_label(_("新增詞"));
  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_add, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_add), "clicked",
     G_CALLBACK (cb_button_add), NULL);


  GtkWidget *button_quit = gtk_button_new_from_stock (GTK_STOCK_QUIT);
  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_quit, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_quit), "clicked",
     G_CALLBACK (do_exit), NULL);


  g_signal_connect (G_OBJECT (mainwin), "delete_event",
                    G_CALLBACK (do_exit), NULL);

  all_wrap();

  gtk_widget_show_all(mainwin);

  gtk_main();
  return 0;
}
예제 #17
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox2;
  GtkWidget *drawingarea1;
  GtkWidget *entry1;
  GtkWidget *table1;
  GtkWidget *buttonNext;
  GtkWidget *buttonPrev;
  GtkWidget *buttonEmptyPrev;
  GtkWidget *alignment2;
  GtkWidget *hbox4;
  GtkWidget *image2;
  GtkWidget *label2;
  GtkWidget *buttonNextEmpty;
  GtkWidget *alignment3;
  GtkWidget *hbox5;
  GtkWidget *image3;
  GtkWidget *label3;
  GtkWidget *buttonDelete;
  GtkWidget *buttonSave;
  GtkWidget *buttonSearch;
  GtkWidget *buttonRewind;
  GtkWidget *dialog_action_area1;
  GtkWidget *closebutton1;

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

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

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

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox2), drawingarea1, TRUE, TRUE, 0);

  entry1 = gtk_entry_new ();
  gtk_widget_show (entry1);
  gtk_box_pack_start (GTK_BOX (vbox2), entry1, FALSE, FALSE, 0);

  table1 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox2), table1, TRUE, TRUE, 0);

  buttonNext = gtk_button_new_from_stock ("gtk-media-next");
  gtk_widget_show (buttonNext);
  gtk_table_attach (GTK_TABLE (table1), buttonNext, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);

  buttonPrev = gtk_button_new_from_stock ("gtk-media-previous");
  gtk_widget_show (buttonPrev);
  gtk_table_attach (GTK_TABLE (table1), buttonPrev, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);

  buttonEmptyPrev = gtk_button_new ();
  gtk_widget_show (buttonEmptyPrev);
  gtk_table_attach (GTK_TABLE (table1), buttonEmptyPrev, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);

  alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (buttonEmptyPrev), alignment2);

  hbox4 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox4);
  gtk_container_add (GTK_CONTAINER (alignment2), hbox4);

  image2 = gtk_image_new_from_stock ("gtk-media-previous", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox4), image2, FALSE, FALSE, 0);

  label2 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Prev. Empty"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox4), label2, FALSE, FALSE, 0);

  buttonNextEmpty = gtk_button_new ();
  gtk_widget_show (buttonNextEmpty);
  gtk_table_attach (GTK_TABLE (table1), buttonNextEmpty, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK), 0, 0);

  alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment3);
  gtk_container_add (GTK_CONTAINER (buttonNextEmpty), alignment3);

  hbox5 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (alignment3), hbox5);

  image3 = gtk_image_new_from_stock ("gtk-media-next", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image3);
  gtk_box_pack_start (GTK_BOX (hbox5), image3, FALSE, FALSE, 0);

  label3 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Next Empty"));
  gtk_widget_show (label3);
  gtk_box_pack_start (GTK_BOX (hbox5), label3, FALSE, FALSE, 0);

  buttonDelete = gtk_button_new_from_stock ("gtk-delete");
  gtk_widget_show (buttonDelete);
  gtk_table_attach (GTK_TABLE (table1), buttonDelete, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonSave = gtk_button_new_from_stock ("gtk-save");
  gtk_widget_show (buttonSave);
  gtk_table_attach (GTK_TABLE (table1), buttonSave, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonSearch = gtk_button_new_from_stock ("gtk-find");
  gtk_widget_show (buttonSearch);
  gtk_table_attach (GTK_TABLE (table1), buttonSearch, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonRewind = gtk_button_new_from_stock ("gtk-home");
  gtk_widget_show (buttonRewind);
  gtk_table_attach (GTK_TABLE (table1), buttonRewind, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

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

  closebutton1 = gtk_button_new_from_stock ("gtk-close");
  gtk_widget_show (closebutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), closebutton1, GTK_RESPONSE_CLOSE);
  GTK_WIDGET_SET_FLAGS (closebutton1, 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, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT (dialog1, entry1, "entry1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, buttonNext, "buttonNext");
  GLADE_HOOKUP_OBJECT (dialog1, buttonPrev, "buttonPrev");
  GLADE_HOOKUP_OBJECT (dialog1, buttonEmptyPrev, "buttonEmptyPrev");
  GLADE_HOOKUP_OBJECT (dialog1, alignment2, "alignment2");
  GLADE_HOOKUP_OBJECT (dialog1, hbox4, "hbox4");
  GLADE_HOOKUP_OBJECT (dialog1, image2, "image2");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, buttonNextEmpty, "buttonNextEmpty");
  GLADE_HOOKUP_OBJECT (dialog1, alignment3, "alignment3");
  GLADE_HOOKUP_OBJECT (dialog1, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (dialog1, image3, "image3");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, buttonDelete, "buttonDelete");
  GLADE_HOOKUP_OBJECT (dialog1, buttonSave, "buttonSave");
  GLADE_HOOKUP_OBJECT (dialog1, buttonSearch, "buttonSearch");
  GLADE_HOOKUP_OBJECT (dialog1, buttonRewind, "buttonRewind");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, closebutton1, "closebutton1");

  return dialog1;
}
예제 #18
0
//******************
GtkWidget   *create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *hscaleHue;
  GtkWidget *hscaleSaturation;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Hue/Saturation"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (QT_TR_NOOP("<b>Hue:</b>"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (QT_TR_NOOP("<b>Saturation:</b>"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  hscaleHue = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -90, 90, 1, 1, 0)));
  gtk_widget_show (hscaleHue);
  gtk_table_attach (GTK_TABLE (table1), hscaleHue, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -10, 10, 1, 1, 0)));
  gtk_widget_show (hscaleSaturation);
  gtk_table_attach (GTK_TABLE (table1), hscaleSaturation, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 1, 0)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

  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, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleHue, "hscaleHue");
  GLADE_HOOKUP_OBJECT (dialog1, hscaleSaturation, "hscaleSaturation");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  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;
}
예제 #19
0
GtkWidget*
create_sheets_new_dialog (void)
{
  GtkWidget *sheets_new_dialog;
  GtkWidget *dialog_vbox2;
  GtkWidget *Typefg;
  GtkWidget *table1;
  GtkWidget *button_browse;
  GSList *table1_group = NULL;
  GtkWidget *radiobutton_svg_shape;
  GtkWidget *combo_from_file;
  GtkWidget *combo_entry_from_file;
  GtkWidget *label_description;
  GtkWidget *radiobutton_sheet;
  GtkWidget *entry_sheet_name;
  GtkWidget *radiobutton_line_break;
  GtkWidget *entry_svg_description;
  GtkWidget *entry_sheet_description;
  GtkWidget *label_svg_description;
  GtkWidget *dialog_action_area2;
  GtkWidget *hbuttonbox1;
  GtkWidget *button_ok;
  GtkWidget *button_cancel;

  sheets_new_dialog = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (sheets_new_dialog), "sheets_new_dialog", sheets_new_dialog);
  gtk_window_set_title (GTK_WINDOW (sheets_new_dialog), _("New"));
  gtk_window_set_role (GTK_WINDOW (sheets_new_dialog), "sheets_new_dialog");
  gtk_window_set_resizable (GTK_WINDOW (sheets_new_dialog), FALSE);

  dialog_vbox2 = GTK_DIALOG (sheets_new_dialog)->vbox;
  gtk_object_set_data (GTK_OBJECT (sheets_new_dialog), "dialog_vbox2", dialog_vbox2);
  gtk_widget_show (dialog_vbox2);

  Typefg = gtk_frame_new (_("Type"));
  gtk_widget_ref (Typefg);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "Typefg", Typefg,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (Typefg);
  gtk_box_pack_start (GTK_BOX (dialog_vbox2), Typefg, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (Typefg), 5);

  table1 = gtk_table_new (5, 4, FALSE);
  gtk_widget_ref (table1);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "table1", table1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table1);
  gtk_container_add (GTK_CONTAINER (Typefg), table1);

  button_browse = gtk_button_new_with_label (_("Browse..."));
  gtk_widget_ref (button_browse);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "button_browse", button_browse,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_browse);
  gtk_table_attach (GTK_TABLE (table1), button_browse, 3, 4, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 3, 0);

  radiobutton_svg_shape = gtk_radio_button_new_with_label (table1_group, _("SVG Shape:"));
  table1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_svg_shape));
  gtk_widget_ref (radiobutton_svg_shape);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "radiobutton_svg_shape", radiobutton_svg_shape,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton_svg_shape);
  gtk_table_attach (GTK_TABLE (table1), radiobutton_svg_shape, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_svg_shape), TRUE);

  combo_from_file = gtk_combo_new ();
  gtk_widget_ref (combo_from_file);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "combo_from_file", combo_from_file,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_from_file);
  gtk_table_attach (GTK_TABLE (table1), combo_from_file, 1, 3, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_combo_set_case_sensitive (GTK_COMBO (combo_from_file), TRUE);

  combo_entry_from_file = GTK_COMBO (combo_from_file)->entry;
  gtk_widget_ref (combo_entry_from_file);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "combo_entry_from_file", combo_entry_from_file,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_entry_from_file);

  label_description = gtk_label_new (_("description:"));
  gtk_widget_ref (label_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "label_description", label_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_description);
  gtk_table_attach (GTK_TABLE (table1), label_description, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (label_description, FALSE);
  gtk_label_set_justify (GTK_LABEL (label_description), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label_description), 0.77, 0.5);

  radiobutton_sheet = gtk_radio_button_new_with_label (table1_group, _("Sheet name:"));
  table1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_sheet));
  gtk_widget_ref (radiobutton_sheet);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "radiobutton_sheet", radiobutton_sheet,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton_sheet);
  gtk_table_attach (GTK_TABLE (table1), radiobutton_sheet, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  entry_sheet_name = gtk_entry_new ();
  gtk_widget_ref (entry_sheet_name);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "entry_sheet_name", entry_sheet_name,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_sheet_name);
  gtk_table_attach (GTK_TABLE (table1), entry_sheet_name, 1, 3, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_usize (entry_sheet_name, 255, -2);
  gtk_widget_set_sensitive (entry_sheet_name, FALSE);

  radiobutton_line_break = gtk_radio_button_new_with_label (table1_group, _("Line Break"));
  table1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton_line_break));
  gtk_widget_ref (radiobutton_line_break);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "radiobutton_line_break", radiobutton_line_break,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton_line_break);
  gtk_table_attach (GTK_TABLE (table1), radiobutton_line_break, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  entry_svg_description = gtk_entry_new ();
  gtk_widget_ref (entry_svg_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "entry_svg_description", entry_svg_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_svg_description);
  gtk_table_attach (GTK_TABLE (table1), entry_svg_description, 1, 3, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  entry_sheet_description = gtk_entry_new ();
  gtk_widget_ref (entry_sheet_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "entry_sheet_description", entry_sheet_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_sheet_description);
  gtk_table_attach (GTK_TABLE (table1), entry_sheet_description, 1, 3, 4, 5,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_usize (entry_sheet_description, 255, -2);
  gtk_widget_set_sensitive (entry_sheet_description, FALSE);

  label_svg_description = gtk_label_new (_("description:"));
  gtk_widget_ref (label_svg_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "label_svg_description", label_svg_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_svg_description);
  gtk_table_attach (GTK_TABLE (table1), label_svg_description, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label_svg_description), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label_svg_description), 0.77, 0.5);

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

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area2), hbuttonbox1, TRUE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END);
  gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 0);

  button_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_ok);
  GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);

  button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
  gtk_widget_ref (button_cancel);
  gtk_object_set_data_full (GTK_OBJECT (sheets_new_dialog), "button_cancel", button_cancel,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_cancel);
  GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);

  g_signal_connect (GTK_OBJECT (button_browse), "clicked",
                      G_CALLBACK (on_sheets_new_dialog_button_browse_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (radiobutton_svg_shape), "toggled",
                      G_CALLBACK (on_sheets_new_dialog_radiobutton_svg_shape_toggled),
                      NULL);
  g_signal_connect (GTK_OBJECT (radiobutton_sheet), "toggled",
                      G_CALLBACK (on_sheets_new_dialog_radiobutton_sheet_toggled),
                      NULL);
  g_signal_connect (GTK_OBJECT (radiobutton_line_break), "toggled",
                      G_CALLBACK (on_sheets_new_dialog_radiobutton_line_break_toggled),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_ok), "clicked",
                      G_CALLBACK (on_sheets_new_dialog_button_ok_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_cancel), "clicked",
                      G_CALLBACK (on_sheets_new_dialog_button_cancel_clicked),
                      NULL);

  gtk_widget_grab_default (button_ok);
  return sheets_new_dialog;
}
예제 #20
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *toolbar1;
  GtkIconSize tmp_toolbar_icon_size;
  GtkWidget *toolitem1;
  GtkWidget *buttonPrev;
  GtkWidget *toolitem2;
  GtkWidget *buttonNext;
  GtkWidget *toolitem3;
  GtkWidget *buttonStack;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Preview"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  toolbar1 = gtk_toolbar_new ();
  gtk_widget_show (toolbar1);
  gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
  tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));

  toolitem1 = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem1);
  gtk_container_add (GTK_CONTAINER (toolbar1), toolitem1);

  buttonPrev = gtk_button_new_from_stock ("gtk-media-previous");
  gtk_widget_show (buttonPrev);
  gtk_container_add (GTK_CONTAINER (toolitem1), buttonPrev);

  toolitem2 = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem2);
  gtk_container_add (GTK_CONTAINER (toolbar1), toolitem2);

  buttonNext = gtk_button_new_from_stock ("gtk-media-next");
  gtk_widget_show (buttonNext);
  gtk_container_add (GTK_CONTAINER (toolitem2), buttonNext);

  toolitem3 = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem3);
  gtk_container_add (GTK_CONTAINER (toolbar1), toolitem3);

  buttonStack = gtk_button_new_with_mnemonic (_("Stack Field"));
  gtk_widget_show (buttonStack);
  gtk_container_add (GTK_CONTAINER (toolitem3), buttonStack);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, TRUE, TRUE, 0);

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

  /* 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, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, toolbar1, "toolbar1");
  GLADE_HOOKUP_OBJECT (dialog1, toolitem1, "toolitem1");
  GLADE_HOOKUP_OBJECT (dialog1, buttonPrev, "buttonPrev");
  GLADE_HOOKUP_OBJECT (dialog1, toolitem2, "toolitem2");
  GLADE_HOOKUP_OBJECT (dialog1, buttonNext, "buttonNext");
  GLADE_HOOKUP_OBJECT (dialog1, toolitem3, "toolitem3");
  GLADE_HOOKUP_OBJECT (dialog1, buttonStack, "buttonStack");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");

  return dialog1;
}
예제 #21
0
GtkWidget*
create_sheets_edit_dialog (void)
{
  GtkWidget *sheets_edit_dialog;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox1;
  GtkWidget *frame_object;
  GtkWidget *table6;
  GtkWidget *label_object_description;
  GtkWidget *entry_object_description;
  GtkWidget *label_object_type;
  GtkWidget *entry_object_type;
  GtkWidget *frame_object_pixmap;
  GtkWidget *pixmap_object;
  GtkWidget *frame_sheet;
  GtkWidget *table3;
  GtkWidget *label_sheet_name;
  GtkWidget *entry_sheet_description;
  GtkWidget *label_sheet_description;
  GtkWidget *entry_sheet_name;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox2;
  GtkWidget *button_ok;
  GtkWidget *button_cancel;

  sheets_edit_dialog = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (sheets_edit_dialog), "sheets_edit_dialog", sheets_edit_dialog);
  gtk_container_set_border_width (GTK_CONTAINER (sheets_edit_dialog), 5);
  gtk_window_set_title (GTK_WINDOW (sheets_edit_dialog), _("Edit Attributes"));
  gtk_window_set_role (GTK_WINDOW (sheets_edit_dialog), "sheets_edit_dialog");
  gtk_window_set_resizable (GTK_WINDOW (sheets_edit_dialog), FALSE);

  dialog_vbox3 = GTK_DIALOG (sheets_edit_dialog)->vbox;
  gtk_object_set_data (GTK_OBJECT (sheets_edit_dialog), "dialog_vbox3", dialog_vbox3);
  gtk_widget_show (dialog_vbox3);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox1, TRUE, TRUE, 0);

  frame_object = gtk_frame_new (_("DiaObject"));
  gtk_widget_ref (frame_object);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "frame_object", frame_object,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame_object);
  gtk_box_pack_start (GTK_BOX (vbox1), frame_object, TRUE, TRUE, 0);

  table6 = gtk_table_new (3, 2, FALSE);
  gtk_widget_ref (table6);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "table6", table6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table6);
  gtk_container_add (GTK_CONTAINER (frame_object), table6);
  gtk_container_set_border_width (GTK_CONTAINER (table6), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table6), 6);

  label_object_description = gtk_label_new (_("Description:"));
  gtk_widget_ref (label_object_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "label_object_description", label_object_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_object_description);
  gtk_table_attach (GTK_TABLE (table6), label_object_description, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label_object_description), 0, 0.5);

  entry_object_description = gtk_entry_new ();
  gtk_widget_ref (entry_object_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "entry_object_description", entry_object_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_object_description);
  gtk_table_attach (GTK_TABLE (table6), entry_object_description, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label_object_type = gtk_label_new (_("Type:"));
  gtk_widget_ref (label_object_type);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "label_object_type", label_object_type,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_object_type);
  gtk_table_attach (GTK_TABLE (table6), label_object_type, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label_object_type), 0, 0.5);

  entry_object_type = gtk_entry_new ();
  gtk_widget_ref (entry_object_type);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "entry_object_type", entry_object_type,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_object_type);
  gtk_table_attach (GTK_TABLE (table6), entry_object_type, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (entry_object_type, FALSE);
  gtk_entry_set_editable (GTK_ENTRY (entry_object_type), FALSE);

  frame_object_pixmap = gtk_frame_new (NULL);
  gtk_widget_ref (frame_object_pixmap);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "frame_object_pixmap", frame_object_pixmap,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame_object_pixmap);
  gtk_table_attach (GTK_TABLE (table6), frame_object_pixmap, 0, 1, 0, 1,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_object_pixmap), GTK_SHADOW_ETCHED_OUT);

  pixmap_object = create_pixmap (sheets_edit_dialog, NULL, FALSE);
  gtk_widget_ref (pixmap_object);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "pixmap_object", pixmap_object,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap_object);
  gtk_container_add (GTK_CONTAINER (frame_object_pixmap), pixmap_object);

  frame_sheet = gtk_frame_new (_("Sheet"));
  gtk_widget_ref (frame_sheet);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "frame_sheet", frame_sheet,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame_sheet);
  gtk_box_pack_start (GTK_BOX (vbox1), frame_sheet, TRUE, TRUE, 0);

  table3 = gtk_table_new (2, 2, FALSE);
  gtk_widget_ref (table3);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "table3", table3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table3);
  gtk_container_add (GTK_CONTAINER (frame_sheet), table3);
  gtk_container_set_border_width (GTK_CONTAINER (table3), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 6);

  label_sheet_name = gtk_label_new (_("Name:"));
  gtk_widget_ref (label_sheet_name);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "label_sheet_name", label_sheet_name,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_sheet_name);
  gtk_table_attach (GTK_TABLE (table3), label_sheet_name, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label_sheet_name), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label_sheet_name), 0, 0.5);

  entry_sheet_description = gtk_entry_new ();
  gtk_widget_ref (entry_sheet_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "entry_sheet_description", entry_sheet_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_sheet_description);
  gtk_table_attach (GTK_TABLE (table3), entry_sheet_description, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label_sheet_description = gtk_label_new (_("Description:"));
  gtk_widget_ref (label_sheet_description);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "label_sheet_description", label_sheet_description,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_sheet_description);
  gtk_table_attach (GTK_TABLE (table3), label_sheet_description, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label_sheet_description), 0, 0.5);

  entry_sheet_name = gtk_entry_new ();
  gtk_widget_ref (entry_sheet_name);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "entry_sheet_name", entry_sheet_name,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_sheet_name);
  gtk_table_attach (GTK_TABLE (table3), entry_sheet_name, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_usize (entry_sheet_name, 220, -2);

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

  hbuttonbox2 = gtk_hbutton_box_new ();
  gtk_widget_ref (hbuttonbox2);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "hbuttonbox2", hbuttonbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox2);
  gtk_box_pack_start (GTK_BOX (dialog_action_area3), hbuttonbox2, TRUE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END);
  gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox2), 0);

  button_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), button_ok);
  GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);

  button_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
  gtk_widget_ref (button_cancel);
  gtk_object_set_data_full (GTK_OBJECT (sheets_edit_dialog), "button_cancel", button_cancel,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), button_cancel);
  GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);

  g_signal_connect (GTK_OBJECT (entry_object_description), "changed",
                      G_CALLBACK (on_sheets_edit_dialog_entry_object_description_changed),
                      NULL);
  g_signal_connect (GTK_OBJECT (entry_sheet_description), "changed",
                      G_CALLBACK (on_sheets_edit_dialog_entry_sheet_description_changed),
                      NULL);
  g_signal_connect (GTK_OBJECT (entry_sheet_name), "changed",
                      G_CALLBACK (on_sheets_edit_dialog_entry_sheet_name_changed),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_ok), "clicked",
                      G_CALLBACK (on_sheets_edit_dialog_button_ok_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (button_cancel), "clicked",
                      G_CALLBACK (on_sheets_edit_dialog_button_cancel_clicked),
                      NULL);

  gtk_widget_grab_default (button_ok);
  return sheets_edit_dialog;
}
예제 #22
0
void
rule_editor_add_rule (RuleEditor *re, rulePtr rule)
{
    GSList			*ruleIter;
    GtkWidget		*hbox, *hbox2, *widget;
    GtkListStore		*store;
    struct changeRequest	*changeRequest, *selected = NULL;
    gint			i = 0, active = 0;

    hbox = gtk_hbox_new (FALSE, 2);	/* hbox to contain all rule widgets */
    hbox2 = gtk_hbox_new (FALSE, 2);	/* another hbox where the rule specific widgets are added */

    /* set up the rule type selection popup */
    store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
    ruleIter = rule_get_available_rules ();
    while (ruleIter) {
        ruleInfoPtr ruleInfo = (ruleInfoPtr)ruleIter->data;
        GtkTreeIter iter;

        /* we add a change request to each popup option */
        changeRequest = g_new0 (struct changeRequest, 1);
        changeRequest->paramHBox = hbox2;
        changeRequest->rule = i;
        changeRequest->editor = re;

        if (0 == i)
            selected = changeRequest;

        /* build the menu option */
        gtk_list_store_append (store, &iter);
        gtk_list_store_set (store, &iter, 0, ruleInfo->title, 1, changeRequest, -1);

        if (rule) {
            if (ruleInfo == rule->ruleInfo) {
                selected = changeRequest;
                active = i;
            }
        }

        ruleIter = g_slist_next (ruleIter);
        i++;
    }
    widget = gtk_combo_box_new ();
    ui_common_setup_combo_text (GTK_COMBO_BOX (widget), 0);

    gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
    gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active);
    g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (on_ruletype_changed), NULL);


    gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);

    if (!rule) {
        /* fake a rule type change to initialize parameter widgets */
        do_ruletype_changed (selected);
    } else {
        rulePtr newRule = rule_new (rule->ruleInfo->ruleId, rule->value, rule->additive);

        /* set up widgets with existing rule type and value */
        rule_editor_setup_widgets (selected, newRule);

        /* add the rule to the list of new rules */
        re->priv->newRules = g_slist_append (re->priv->newRules, newRule);
    }

    /* add remove button */
    changeRequest = g_new0 (struct changeRequest, 1);
    changeRequest->hbox = hbox;
    changeRequest->paramHBox = hbox2;
    changeRequest->editor = re;
    widget = gtk_button_new_from_stock ("gtk-remove");
    gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (on_ruleremove_clicked), changeRequest);

    /* and insert everything in the dialog */
    gtk_widget_show_all (hbox);
    gtk_box_pack_start (GTK_BOX (re->priv->root), hbox, FALSE, TRUE, 0);
}
예제 #23
0
void sndstretch_about(void)
{
	GtkWidget * vbox, * scrolltext, * button;
	GtkWidget * titlelabel, * copylabel;
	GtkWidget * text;
	GtkTextBuffer * textbuffer;
	GtkTextIter iter;
	GtkWidget * copyhbox, * copy_rbox, * copy_lbox;


	if (sndstretch_about_dialog != NULL)
		return;

	sndstretch_about_dialog = gtk_dialog_new();
	gtk_widget_show(sndstretch_about_dialog);

	GtkWidget * logo = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data
	 ((const gchar * *) sndstretch_xmms_logo_xpm));
	GtkWidget * FBlogo = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data
	 ((const gchar * *) FB_logo_xpm));

	g_signal_connect (sndstretch_about_dialog, "destroy", (GCallback)
	 sndstretch_about_destroy_cb, NULL);
	gtk_window_set_title(GTK_WINDOW(sndstretch_about_dialog), _("About SndStretch"));


	/* labels */
	titlelabel = gtk_label_new(sndstretch_title_text);
	copylabel  = gtk_label_new(sndstretch_about_text);
	gtk_label_set_justify(GTK_LABEL(copylabel), GTK_JUSTIFY_LEFT);

	copy_lbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
	copy_rbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
	gtk_box_pack_end  (GTK_BOX(copy_lbox), FBlogo,    FALSE, TRUE,  0);
	gtk_box_pack_start(GTK_BOX(copy_rbox), copylabel, FALSE, TRUE,  0);
	copyhbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
	gtk_box_pack_start(GTK_BOX(copyhbox), copy_lbox,    TRUE, TRUE,  5);
	gtk_box_pack_start(GTK_BOX(copyhbox), copy_rbox,    TRUE, TRUE,  5);

	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
	gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area ((GtkDialog *)
	 sndstretch_about_dialog), vbox, TRUE, TRUE, 5);

	scrolltext = gtk_scrolled_window_new(NULL,NULL);
	text = gtk_text_view_new();
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
	gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
	textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
	gtk_text_buffer_get_iter_at_offset(textbuffer, &iter, 0);
	gtk_text_buffer_insert(textbuffer, &iter,
						   sndstretch_GPL_text, strlen(sndstretch_GPL_text));


	scrolltext = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolltext),
								   GTK_POLICY_AUTOMATIC,
								   GTK_POLICY_AUTOMATIC);
	gtk_container_add(GTK_CONTAINER(scrolltext), text);

	gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, TRUE, 5);
	gtk_box_pack_start(GTK_BOX(vbox), titlelabel, FALSE, TRUE, 5);
	gtk_box_pack_start(GTK_BOX(vbox), copyhbox, FALSE, TRUE, 5);
	gtk_box_pack_start(GTK_BOX(vbox), scrolltext, TRUE, TRUE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);

	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
	gtk_box_pack_start ((GtkBox *) gtk_dialog_get_action_area ((GtkDialog *)
	 sndstretch_about_dialog), button, FALSE, FALSE, 0);
	g_signal_connect (button, "clicked", (GCallback) sndstretch_about_ok_cb,
	 NULL);
	gtk_widget_set_can_default (button, TRUE);
	gtk_widget_grab_default(button);
	gtk_widget_show(button);
	gtk_widget_show_all(sndstretch_about_dialog);
}
예제 #24
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkWidget *entryToolame;
  GtkWidget *buttonToolame;
  GtkWidget *label5;
  GtkWidget *entryLame;
  GtkWidget *buttonLame;
  GtkWidget *label6;
  GtkWidget *entryLvemux;
  GtkWidget *buttonLvemux;
  GtkWidget *label7;
  GtkWidget *entryRequant;
  GtkWidget *buttonRequant;
  GtkWidget *label8;
  GtkWidget *button_audioDevice;
  GtkWidget *hseparator1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), _("Preferences"));

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

  table1 = gtk_table_new (6, 3, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);

  label1 = gtk_label_new (_("Name"));
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new (_("Path"));
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new (_("Select"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new (_("Toolame"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  entryToolame = gtk_entry_new ();
  gtk_widget_show (entryToolame);
  gtk_table_attach (GTK_TABLE (table1), entryToolame, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonToolame = gtk_button_new_with_mnemonic (_("Select"));
  gtk_widget_show (buttonToolame);
  gtk_table_attach (GTK_TABLE (table1), buttonToolame, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label5 = gtk_label_new (_("Lame"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  entryLame = gtk_entry_new ();
  gtk_widget_show (entryLame);
  gtk_table_attach (GTK_TABLE (table1), entryLame, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonLame = gtk_button_new_with_mnemonic (_("Select"));
  gtk_widget_show (buttonLame);
  gtk_table_attach (GTK_TABLE (table1), buttonLame, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label6 = gtk_label_new (_("LveMux"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  entryLvemux = gtk_entry_new ();
  gtk_widget_show (entryLvemux);
  gtk_table_attach (GTK_TABLE (table1), entryLvemux, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonLvemux = gtk_button_new_with_mnemonic (_("Select"));
  gtk_widget_show (buttonLvemux);
  gtk_table_attach (GTK_TABLE (table1), buttonLvemux, 2, 3, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label7 = gtk_label_new (_("M2VRequantizer"));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);

  entryRequant = gtk_entry_new ();
  gtk_widget_show (entryRequant);
  gtk_table_attach (GTK_TABLE (table1), entryRequant, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  buttonRequant = gtk_button_new_with_mnemonic (_("Select"));
  gtk_widget_show (buttonRequant);
  gtk_table_attach (GTK_TABLE (table1), buttonRequant, 2, 3, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label8 = gtk_label_new (_("AudioDevice"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 5, 6,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label8), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);

  button_audioDevice = gtk_button_new_with_mnemonic (_("Select Device"));
  gtk_widget_show (button_audioDevice);
  gtk_table_attach (GTK_TABLE (table1), button_audioDevice, 1, 2, 5, 6,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_show (hseparator1);
  gtk_table_attach (GTK_TABLE (table1), hseparator1, 2, 3, 5, 6,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  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, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialog1, entryToolame, "entryToolame");
  GLADE_HOOKUP_OBJECT (dialog1, buttonToolame, "buttonToolame");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialog1, entryLame, "entryLame");
  GLADE_HOOKUP_OBJECT (dialog1, buttonLame, "buttonLame");
  GLADE_HOOKUP_OBJECT (dialog1, label6, "label6");
  GLADE_HOOKUP_OBJECT (dialog1, entryLvemux, "entryLvemux");
  GLADE_HOOKUP_OBJECT (dialog1, buttonLvemux, "buttonLvemux");
  GLADE_HOOKUP_OBJECT (dialog1, label7, "label7");
  GLADE_HOOKUP_OBJECT (dialog1, entryRequant, "entryRequant");
  GLADE_HOOKUP_OBJECT (dialog1, buttonRequant, "buttonRequant");
  GLADE_HOOKUP_OBJECT (dialog1, label8, "label8");
  GLADE_HOOKUP_OBJECT (dialog1, button_audioDevice, "button_audioDevice");
  GLADE_HOOKUP_OBJECT (dialog1, hseparator1, "hseparator1");
  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;
}
void
gnetconfig_if_detect_dlg_init (void)
{
	GtkWidget 		*button_save;
	GtkWidget 		*button_cancel;
	GtkWidget		*button_box;
	GtkWidget  		*vbox;
	GtkWidget		*label;
	GtkWidget		*scrollw;
	GtkListStore 		*store;
	GtkCellRenderer	 	*renderer;
	GtkTreeViewColumn	*column;

	if_detect_dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW(if_detect_dlg), 450, 200);
	scrollw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrollw), GTK_SHADOW_ETCHED_OUT);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrollw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_container_set_border_width (GTK_CONTAINER(if_detect_dlg), 8);
	gtk_window_set_title (GTK_WINDOW(if_detect_dlg), _("Detected Interfaces"));
	gtk_window_set_transient_for (GTK_WINDOW(if_detect_dlg), GTK_WINDOW(gn_if_add_dialog));
	vbox = gtk_vbox_new (FALSE, 4);
	if_detect_treeview = gtk_tree_view_new ();
	label = gtk_label_new (_("The following interfaces were detected"));
	gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, TRUE, 2);
	gtk_container_add (GTK_CONTAINER(scrollw), GTK_WIDGET(if_detect_treeview));
	gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(scrollw), TRUE, TRUE, 2);
	gtk_container_add (GTK_CONTAINER(if_detect_dlg), GTK_WIDGET(vbox));
	store = gtk_list_store_new (5, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
	gtk_tree_view_set_model (GTK_TREE_VIEW(if_detect_treeview), GTK_TREE_MODEL(store));
	
	renderer = gtk_cell_renderer_pixbuf_new ();
	column = gtk_tree_view_column_new_with_attributes ("S",
							renderer,
							"pixbuf", 0,
							NULL);
	gtk_tree_view_column_set_resizable (column, FALSE);
	gtk_tree_view_append_column (GTK_TREE_VIEW(if_detect_treeview), column);

	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes ("Interface",
							renderer,
							"text", 1,
							NULL);
	gtk_tree_view_column_set_resizable (column, FALSE);
	gtk_tree_view_column_set_min_width (column, 40);
	g_object_set (G_OBJECT(column), "expand", FALSE, "spacing", 4, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW(if_detect_treeview), column);

	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes ("Description",
							renderer,
							"text", 2,
							NULL);
	gtk_tree_view_column_set_min_width (column, 60);
	gtk_tree_view_column_set_resizable (column, TRUE);
	g_object_set (G_OBJECT(column), "expand", TRUE, "spacing", 4, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW(if_detect_treeview), column);
	
	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes ("Status",
							renderer,
							"text", 3,
							NULL);
	gtk_tree_view_column_set_min_width (column, 60);
	gtk_tree_view_column_set_resizable (column, FALSE);
	gtk_tree_view_append_column (GTK_TREE_VIEW(if_detect_treeview), column);

	button_save = gtk_button_new_from_stock (GTK_STOCK_OK);
	button_cancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
	button_box = gtk_hbutton_box_new ();
	gtk_container_add (GTK_CONTAINER(button_box), button_save);
	gtk_container_add (GTK_CONTAINER(button_box), button_cancel);
	gtk_box_pack_start (GTK_BOX(vbox), GTK_WIDGET(button_box), FALSE, FALSE, 2);

	g_signal_connect (G_OBJECT(button_save),
			"clicked",
			G_CALLBACK(cb_gn_if_detect_ok_clicked),
			NULL);
	g_signal_connect (G_OBJECT(button_cancel),
			"clicked",
			G_CALLBACK(cb_gn_if_detect_cancel_clicked),
			NULL);

	g_signal_connect (G_OBJECT(if_detect_dlg),
			"delete-event",
			G_CALLBACK(gtk_widget_hide),
			NULL);

	return;
}
예제 #26
0
static void create_main_win()
{
  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  if (hime_setup_window_type_utility)
    gtk_window_set_type_hint(GTK_WINDOW(main_window), GDK_WINDOW_TYPE_HINT_UTILITY);
  gtk_window_set_position(GTK_WINDOW(main_window), GTK_WIN_POS_CENTER);

  g_signal_connect (G_OBJECT (main_window), "delete_event",
                     G_CALLBACK (close_application),
                     NULL);

  gtk_window_set_title (GTK_WINDOW (main_window), _("hime 設定/工具"));
  set_window_hime_icon(main_window);
  gtk_window_set_resizable (GTK_WINDOW (main_window), FALSE);

  GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL);

#ifdef USE_WIDE
  GtkWidget *box = gtk_hbox_new (TRUE, 0);
  gtk_container_add (GTK_CONTAINER (main_window), box);
  gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);

  GtkWidget *button_default_input_method1 = gtk_button_new_with_label(_("開啟/關閉/預設輸入法"));
  gtk_box_pack_start (GTK_BOX (vbox), button_default_input_method1, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_default_input_method1), "clicked",
                    G_CALLBACK (create_gtablist_window), GINT_TO_POINTER(1));

  GtkWidget *button_default_input_method2 = gtk_button_new_with_label(_("輸入法伺服器"));
  gtk_box_pack_start (GTK_BOX (vbox), button_default_input_method2, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_default_input_method2), "clicked",
                    G_CALLBACK (create_gtablist_window), GINT_TO_POINTER(2));
#else
  gtk_container_add (GTK_CONTAINER (main_window), vbox);

  GtkWidget *button_default_input_method = gtk_button_new_with_label(_("開啟/關閉/預設輸入法"));
  gtk_box_pack_start (GTK_BOX (vbox), button_default_input_method, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_default_input_method), "clicked",
                    G_CALLBACK (create_gtablist_window), GINT_TO_POINTER(0));
#endif

  GtkWidget *button_appearance_conf = gtk_button_new_with_label(_("外觀設定"));
  gtk_box_pack_start (GTK_BOX (vbox), button_appearance_conf, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_appearance_conf), "clicked",
                    G_CALLBACK (cb_appearance_conf), NULL);

  GtkWidget *button_kbm = gtk_button_new_with_label(_("注音/詞音/拼音設定"));
  gtk_box_pack_start (GTK_BOX (vbox), button_kbm, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_kbm), "clicked",
                    G_CALLBACK (cb_kbm), NULL);

#ifdef USE_WIDE
  GtkWidget *button_gtab_conf = gtk_button_new_with_label(_("倉頡/行列/大易 外觀設定"));
  gtk_box_pack_start (GTK_BOX (vbox), button_gtab_conf, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_gtab_conf), "clicked",
                    G_CALLBACK (create_gtab_conf_window), GINT_TO_POINTER(1));
  button_gtab_conf = gtk_button_new_with_label(_("倉頡/行列/大易 行為設定"));
  gtk_box_pack_start (GTK_BOX (vbox), button_gtab_conf, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_gtab_conf), "clicked",
                    G_CALLBACK (create_gtab_conf_window), GINT_TO_POINTER(2));
#else
  GtkWidget *button_gtab_conf = gtk_button_new_with_label(_("倉頡/行列/大易設定"));
  gtk_box_pack_start (GTK_BOX (vbox), button_gtab_conf, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_gtab_conf), "clicked",
                    G_CALLBACK (create_gtab_conf_window), GINT_TO_POINTER(0));
#endif

#ifdef USE_WIDE
  vbox = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);
#endif

  GtkWidget *button_alt_shift = gtk_button_new_with_label(_("alt-shift 片語編輯"));
  gtk_box_pack_start (GTK_BOX (vbox), button_alt_shift, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_alt_shift), "clicked",
                    G_CALLBACK (cb_alt_shift), NULL);

  GtkWidget *button_symbol_table = gtk_button_new_with_label(_("符號表編輯"));
  gtk_box_pack_start (GTK_BOX (vbox), button_symbol_table, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_symbol_table), "clicked",
                    G_CALLBACK (cb_symbol_table), NULL);

#if !USE_WIDE
  if (!hime_status_tray)
  {
#endif
    GtkWidget *button_gb_output_toggle = gtk_button_new_with_label(_("啟用/關閉簡體字輸出"));
    gtk_box_pack_start (GTK_BOX (vbox), button_gb_output_toggle, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (button_gb_output_toggle), "clicked",
                      G_CALLBACK (cb_gb_output_toggle), NULL);

    void kbm_open_close(GtkButton *checkmenuitem, gboolean b_show);
    GtkWidget *button_win_kbm_toggle = gtk_button_new_with_label(_("顯示/隱藏輸入法鍵盤"));
    gtk_box_pack_start (GTK_BOX (vbox), button_win_kbm_toggle, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (button_win_kbm_toggle), "clicked",
                      G_CALLBACK (cb_win_kbm_toggle), NULL);
#if !USE_WIDE
  }
#endif

  GtkWidget *button_gb_translate_toggle = gtk_button_new_with_label(_("剪貼區 簡體字->正體字"));
  gtk_box_pack_start (GTK_BOX (vbox), button_gb_translate_toggle, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_gb_translate_toggle), "clicked",
                    G_CALLBACK (cb_gb_translate_toggle), NULL);

  GtkWidget *button_juying_learn_toggle = gtk_button_new_with_label(_("剪貼區 注音查詢"));
  gtk_box_pack_start (GTK_BOX (vbox), button_juying_learn_toggle, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_juying_learn_toggle), "clicked",
                    G_CALLBACK (cb_juying_learn), NULL);

#ifdef USE_WIDE
  vbox = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox), GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);
#endif

  GtkWidget *expander_ts;
  GtkWidget *vbox_ts;
#ifdef USE_WIDE
  vbox_ts = vbox;
#else
  expander_ts = gtk_expander_new (_("詞庫選項"));
  gtk_box_pack_start (GTK_BOX (vbox), expander_ts, FALSE, FALSE, 0);
  vbox_ts = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_ts), GTK_ORIENTATION_VERTICAL);
  gtk_container_add (GTK_CONTAINER (expander_ts), vbox_ts);
#endif

  GtkWidget *button_ts_export = gtk_button_new_with_label(_("詞庫匯出"));
  gtk_widget_set_hexpand (button_ts_export, TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_export, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_ts_export), "clicked",
                    G_CALLBACK (cb_ts_export), NULL);

  GtkWidget *button_ts_import = gtk_button_new_with_label(_("詞庫匯入"));
  gtk_widget_set_hexpand (button_ts_import, TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_import, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_ts_import), "clicked",
                    G_CALLBACK (cb_ts_import), NULL);

  GtkWidget *button_ts_edit = gtk_button_new_with_label(_("詞庫編輯"));
  gtk_widget_set_hexpand (button_ts_edit, TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_edit, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_ts_edit), "clicked",
                    G_CALLBACK (cb_ts_edit), NULL);

  GtkWidget *button_hime_tslearn = gtk_button_new_with_label(_("從文章學習詞"));
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_hime_tslearn, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_hime_tslearn), "clicked",
                    G_CALLBACK (cb_tslearn), NULL);

  GtkWidget *button_ts_import_sys = gtk_button_new_with_label(_("匯入系統的詞庫"));
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_import_sys, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_ts_import_sys), "clicked",
                    G_CALLBACK (cb_ts_import_sys), NULL);

  gboolean show_about=TRUE;
  int i;
  for (i=0; i < inmdN; i++) {
    INMD *pinmd = &inmd[i];
    if (pinmd->method_type != method_type_MODULE || pinmd->disabled)
      continue;

    HIME_module_callback_functions *f = init_HIME_module_callback_functions(pinmd->filename);
    if (!f)
      continue;

    if (!f->module_setup_window_create) {
      free(f);
      continue;
    }

    char tt[128];
    strcpy(tt, pinmd->cname);
    strcat(tt, _("設定"));
    GtkWidget *button_module_input_method = gtk_button_new_with_label(tt);
    gtk_box_pack_start (GTK_BOX (vbox), button_module_input_method, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (button_module_input_method), "clicked",
                    G_CALLBACK (f->module_setup_window_create), GINT_TO_POINTER(hime_setup_window_type_utility));
#ifdef USE_WIDE
    show_about=FALSE;
#endif
  }

  if (show_about)
  {
    GtkWidget *button_about = gtk_button_new_from_stock (GTK_STOCK_ABOUT);
    gtk_box_pack_start (GTK_BOX (vbox), button_about, FALSE, FALSE, 0);
    g_signal_connect (G_OBJECT (button_about), "clicked",
                      G_CALLBACK (create_about_window),  NULL);
  }

#if !USE_WIDE
  GtkWidget *button_quit = gtk_button_new_from_stock (GTK_STOCK_QUIT);
  gtk_box_pack_start (GTK_BOX (vbox), button_quit, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button_quit), "clicked",
                    G_CALLBACK (close_application), NULL);
#endif

  gtk_widget_show_all(main_window);
}
예제 #27
0
MyChecksDialog::MyChecksDialog(WindowReferences * references_window)
{
  // Save variables.
  my_references_window = references_window;

  // Shortcuts.
  Shortcuts shortcuts(0);

  // Build gui.
  mychecksdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(mychecksdialog), _("My checks"));
  gtk_window_set_position(GTK_WINDOW(mychecksdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(mychecksdialog), TRUE);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(mychecksdialog));
  gtk_widget_show(dialog_vbox1);

  vbox1 = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(vbox1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0);

  label1 = gtk_label_new(_("Chapters and verses"));
  gtk_widget_show(label1);
  gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);

  checkbutton_chapters_verses = gtk_check_button_new_with_mnemonic(_("Chapters and verses"));
  gtk_widget_show(checkbutton_chapters_verses);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_chapters_verses, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_chapters_verses);

  hseparator1 = gtk_hseparator_new();
  gtk_widget_show(hseparator1);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator1, TRUE, TRUE, 0);

  label2 = gtk_label_new(_("Markers"));
  gtk_widget_show(label2);
  gtk_box_pack_start(GTK_BOX(vbox1), label2, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);

  checkbutton_markers_validate = gtk_check_button_new_with_mnemonic(_("Validate"));
  gtk_widget_show(checkbutton_markers_validate);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_markers_validate, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_markers_validate);

  checkbutton_markers_count = gtk_check_button_new_with_mnemonic(_("Count"));
  gtk_widget_show(checkbutton_markers_count);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_markers_count, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_markers_count);

  checkbutton_markers_compare = gtk_check_button_new_with_mnemonic(_("Compare"));
  gtk_widget_show(checkbutton_markers_compare);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_markers_compare, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_markers_compare);

  checkbutton_markers_spacing = gtk_check_button_new_with_mnemonic(_("Spacing"));
  gtk_widget_show(checkbutton_markers_spacing);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_markers_spacing, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_markers_spacing);

  hseparator2 = gtk_hseparator_new();
  gtk_widget_show(hseparator2);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator2, TRUE, TRUE, 0);

  label3 = gtk_label_new(_("Characters"));
  gtk_widget_show(label3);
  gtk_box_pack_start(GTK_BOX(vbox1), label3, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);

  checkbutton_characters_inventory = gtk_check_button_new_with_mnemonic(_("Inventory"));
  gtk_widget_show(checkbutton_characters_inventory);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_characters_inventory, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_characters_inventory);

  checkbutton_characters_unwanted_patterns = gtk_check_button_new_with_mnemonic(_("Unwanted patterns"));
  gtk_widget_show(checkbutton_characters_unwanted_patterns);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_characters_unwanted_patterns, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_characters_unwanted_patterns);

  hseparator3 = gtk_hseparator_new();
  gtk_widget_show(hseparator3);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator3, TRUE, TRUE, 0);

  label4 = gtk_label_new(_("Words"));
  gtk_widget_show(label4);
  gtk_box_pack_start(GTK_BOX(vbox1), label4, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label4), 0, 0.5);

  checkbutton_words_capitalization = gtk_check_button_new_with_mnemonic(_("Capitalization"));
  gtk_widget_show(checkbutton_words_capitalization);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_words_capitalization, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_words_capitalization);

  checkbutton_words_repetition = gtk_check_button_new_with_mnemonic(_("Repetition"));
  gtk_widget_show(checkbutton_words_repetition);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_words_repetition, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_words_repetition);

  checkbutton_words_unwanted = gtk_check_button_new_with_mnemonic(_("Unwanted"));
  gtk_widget_show(checkbutton_words_unwanted);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_words_unwanted, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_words_unwanted);

  checkbutton_words_inventory = gtk_check_button_new_with_mnemonic(_("Inventory"));
  gtk_widget_show(checkbutton_words_inventory);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_words_inventory, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_words_inventory);

  hseparator4 = gtk_hseparator_new();
  gtk_widget_show(hseparator4);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator4, TRUE, TRUE, 0);

  label5 = gtk_label_new(_("Punctuation"));
  gtk_widget_show(label5);
  gtk_box_pack_start(GTK_BOX(vbox1), label5, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label5), 0, 0.5);

  checkbutton_punctuation_matching_pairs = gtk_check_button_new_with_mnemonic(_("Matching pairs"));
  gtk_widget_show(checkbutton_punctuation_matching_pairs);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_punctuation_matching_pairs, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_punctuation_matching_pairs);

  hseparator5 = gtk_hseparator_new();
  gtk_widget_show(hseparator5);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator5, TRUE, TRUE, 0);

  label6 = gtk_label_new(_("References"));
  gtk_widget_show(label6);
  gtk_box_pack_start(GTK_BOX(vbox1), label6, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);

  checkbutton_references_inventory = gtk_check_button_new_with_mnemonic(_("Inventory"));
  gtk_widget_show(checkbutton_references_inventory);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_references_inventory, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_references_inventory);

  checkbutton_references_validate = gtk_check_button_new_with_mnemonic(_("Validate"));
  gtk_widget_show(checkbutton_references_validate);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton_references_validate, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_references_validate);

  dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(mychecksdialog));
  gtk_widget_show(dialog_action_area1);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

  new InDialogHelp(mychecksdialog, NULL, &shortcuts, NULL);

  cancelbutton = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(mychecksdialog), cancelbutton, GTK_RESPONSE_CANCEL);
  gtk_widget_set_can_default (GTK_WIDGET (cancelbutton), true);

  shortcuts.stockbutton(cancelbutton);

  okbutton = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(mychecksdialog), okbutton, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton), true);

  shortcuts.stockbutton(okbutton);

  shortcuts.process();

  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  gtk_widget_grab_default(okbutton);
  gtk_widget_grab_focus(okbutton);

  // Set checkbuttons.
  extern Settings *settings;
  ustring pattern = settings->genconfig.mychecks_get();
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_chapters_verses), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_markers_validate), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_markers_count), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_markers_compare), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_characters_inventory), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_characters_unwanted_patterns), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_words_capitalization), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_words_repetition), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_words_unwanted), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_words_inventory), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_punctuation_matching_pairs), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_markers_spacing), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_references_inventory), bitpattern_take(pattern));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_references_validate), bitpattern_take(pattern));
}
예제 #28
0
static GtkWidget *create_window(struct field_views *fields_vws, GtkWidget *window)
{
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *button;
	GtkWidget *label;
	GtkWidget *scrolled_window;
	GtkWidget *combobox_field;
	GtkWidget *combobox_comp;
	
	GtkTreeSelection *selection;
	GtkTreeModel *model;
	GtkTreeModel *child_model;
	gulong changed_handler_id;
	GList *list;
	
	GtkWidget *expander;
	GtkWidget *hbox_1, *vbox_1, *Frame_1;
	GtkWidget *label_1;
	GtkWidget *scrolled_window_1;
	GtkWidget *hbox_11;
	
	GtkTreeSelection *selection_1;
	GtkTreeModel *model_1;
	GtkTreeModel *child_model_1;
	gulong changed_handler_id_1;
	GList *list_1;
	
	
	
    GtkCellRenderer *column;
	
	char *c_label;
	
	c_label = (char *)calloc(KCHARA_C, sizeof(char));
	
	
	vbox = gtk_vbox_new(FALSE, 0);

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

	/* Delete data bottun */
	button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(button), "clicked", 
				G_CALLBACK(remove_field_to_use), fields_vws);

	/* Close window bottun */
	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(button), "clicked", 
				G_CALLBACK(cb_close_window), window);

	/* ラベル */
	label = gtk_label_new("");
	gtk_box_pack_end(GTK_BOX(hbox), label, TRUE, TRUE, 0);

	scrolled_window = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_widget_set_size_request(scrolled_window, 400, 300);
	gtk_container_add(GTK_CONTAINER(scrolled_window), fields_vws->used_tree_view);
	gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);

	/*
	 * selectionにchangedシグナルハンドラを登録する。
	 * 後で同じchild_modelを使用しているselectionのchangedシグナルをブロック出来るように
	 * child_modelにselectionのリストを、selectionにシグナルハンドラIDを登録する。
	 * changedハンドラ内で使用するlabelも同様に登録しておく。
	 */
	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(fields_vws->used_tree_view));
	changed_handler_id = g_signal_connect(G_OBJECT(selection), "changed",
				G_CALLBACK(sum_selected_rows), NULL);
	g_object_set_data(G_OBJECT(selection), "changed_handler_id", GUINT_TO_POINTER(changed_handler_id));
	g_object_set_data(G_OBJECT(selection), "label", label);

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(fields_vws->used_tree_view));
	child_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(model));
	list = g_object_get_data(G_OBJECT(child_model), "selection_list");
	list = g_list_append(list, selection);
	g_object_set_data(G_OBJECT(child_model), "selection_list", list);
	
	
	get_label_MHD_control_head(c_label);
	expander = gtk_expander_new_with_mnemonic("Field to add");
	
	vbox_1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
	Frame_1 = gtk_frame_new("");
	gtk_frame_set_shadow_type(GTK_FRAME(Frame_1), GTK_SHADOW_IN);
	
	scrolled_window_1 = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window_1),
				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
//	gtk_widget_set_size_request(scrolled_window_1, 400, 300);
	gtk_container_add(GTK_CONTAINER(scrolled_window_1), fields_vws->unused_field_tree_view);
	gtk_box_pack_start(GTK_BOX(vbox_1), scrolled_window_1, TRUE, TRUE, 0);

	
	
	gtk_container_add(GTK_CONTAINER(Frame_1), vbox_1);
	
	/* Add data bottun */
	hbox_1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
	button = gtk_button_new_from_stock(GTK_STOCK_ADD);
	gtk_box_pack_start(GTK_BOX(hbox_1), button, FALSE, TRUE, 0);
	g_signal_connect(G_OBJECT(button), "clicked", 
				G_CALLBACK(add_field_to_use), fields_vws);
	label_1 = gtk_label_new("");
	gtk_box_pack_end(GTK_BOX(hbox_1), label_1, TRUE, TRUE, 0);

	gtk_box_pack_start(GTK_BOX(hbox_1), gtk_label_new("  "), FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox_1), Frame_1, TRUE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(expander), hbox_1);
	gtk_box_pack_start(GTK_BOX(vbox), expander, TRUE, TRUE, 0);
	
	
	
	selection_1 = gtk_tree_view_get_selection(GTK_TREE_VIEW(fields_vws->unused_field_tree_view));
	changed_handler_id_1 = g_signal_connect(G_OBJECT(selection_1), "changed", 
				G_CALLBACK(sum_selected_rows), NULL);
	g_object_set_data(G_OBJECT(selection_1), "changed_handler_id", GUINT_TO_POINTER(changed_handler_id_1));
	g_object_set_data(G_OBJECT(selection_1), "label", label_1);

	model_1 = gtk_tree_view_get_model(GTK_TREE_VIEW(fields_vws->unused_field_tree_view));
	child_model_1 = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(model_1));
	list_1 = g_object_get_data(G_OBJECT(child_model_1), "selection_list");
	list_1 = g_list_append(list_1, selection_1);
	g_object_set_data(G_OBJECT(child_model_1), "selection_list", list_1);
	
	
	
	hbox_11 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
	combobox_field = gtk_combo_box_new_with_model(model);
	g_signal_connect(G_OBJECT(combobox_field), "changed", 
				G_CALLBACK(format_entry_text_callback), fields_vws->used_tree_view);
	column = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_field), column, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_field), column,
				"text", COLUMN_FIELD_NAME, NULL);
	gtk_box_pack_start(GTK_BOX(hbox_11), combobox_field, FALSE, FALSE, 0);
	
	combobox_comp = gtk_combo_box_new();
	g_signal_connect(G_OBJECT(combobox_comp), "changed", 
				G_CALLBACK(format_entry_text_callback), fields_vws->used_tree_view);
	column = gtk_cell_renderer_text_new();
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_comp), column, TRUE);
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_comp), column,
				"text", COLUMN_FIELD_NAME, NULL);
	gtk_box_pack_start(GTK_BOX(hbox_11), combobox_comp, FALSE, FALSE, 0);
	
	gtk_box_pack_start(GTK_BOX(vbox), hbox_11, FALSE, FALSE, 0);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	return window;
}
예제 #29
0
GtkWidget *
range_widget_create()
{
	GtkWidget *range_dialog;
	GtkWidget *dialog_vbox4;
	GtkWidget *vbox7;
	GtkWidget *hbox46;
	GtkWidget *label43;
	GtkWidget *label44;
	GtkWidget *hbox42;
	GtkWidget *hbox43;
	GtkWidget *hbox44;
	GtkObject *start_hours_adj;
	GtkObject *start_minutes_adj;
	GtkObject *start_seconds_adj;
	GtkWidget *hbox45;
	GtkObject *end_hours_adj;
	GtkObject *end_minutes_adj;
	GtkObject *end_seconds_adj;
	GtkWidget *dialog_action_area4;
	GtkWidget *cancel_button;
	GtkWidget *ok_button;
	GtkWidget *alignment55;
	GtkWidget *hbox341;
	GtkWidget *image49;
	GtkWidget *label97;
	gchar *val;

	range_dialog = gtk_dialog_new();
	gtk_window_set_title(GTK_WINDOW(range_dialog), TIMELOG_TITLE);
	gtk_window_set_modal(GTK_WINDOW(range_dialog), FALSE);
	gtk_window_set_type_hint(GTK_WINDOW(range_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

	dialog_vbox4 = GTK_DIALOG(range_dialog)->vbox;
	gtk_widget_show(dialog_vbox4);

	vbox7 = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(vbox7);
	gtk_box_pack_start(GTK_BOX(dialog_vbox4), vbox7, TRUE, TRUE, 0);

	hbox46 = gtk_hbox_new(FALSE, 20);
	gtk_widget_show(hbox46);
	gtk_box_pack_start(GTK_BOX(vbox7), hbox46, FALSE, FALSE, 5);

	label43 = gtk_label_new(_("Start Time"));
	gtk_widget_show(label43);
	gtk_box_pack_start(GTK_BOX(hbox46), label43, TRUE, TRUE, 0);

	label44 = gtk_label_new(_("End Time"));
	gtk_widget_show(label44);
	gtk_box_pack_start(GTK_BOX(hbox46), label44, TRUE, TRUE, 0);

	hbox42 = gtk_hbox_new(FALSE, 20);
	gtk_widget_show(hbox42);
	gtk_box_pack_start(GTK_BOX(vbox7), hbox42, TRUE, TRUE, 0);

	start_calendar = gtk_calendar_new();
	gtk_widget_show(start_calendar);
	gtk_box_pack_start(GTK_BOX(hbox42), start_calendar, TRUE, TRUE, 0);
	gtk_calendar_display_options(GTK_CALENDAR(start_calendar),
			GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);

	end_calendar = gtk_calendar_new();
	gtk_widget_show(end_calendar);
	gtk_box_pack_start(GTK_BOX(hbox42), end_calendar, TRUE, TRUE, 0);
	gtk_calendar_display_options(GTK_CALENDAR(end_calendar),
			GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);

	hbox43 = gtk_hbox_new(FALSE, 20);
	gtk_widget_show(hbox43);
	gtk_box_pack_start(GTK_BOX(vbox7), hbox43, FALSE, TRUE, 10);

	hbox44 = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(hbox44);
	gtk_box_pack_start(GTK_BOX(hbox43), hbox44, TRUE, TRUE, 0);

	start_hours_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	start_hours = gtk_spin_button_new(GTK_ADJUSTMENT(start_hours_adj), 1, 0);
	gtk_widget_show(start_hours);
	gtk_box_pack_start(GTK_BOX(hbox44), start_hours, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(start_hours), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(start_hours), TRUE);

	start_minutes_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	start_minutes = gtk_spin_button_new(GTK_ADJUSTMENT(start_minutes_adj), 1, 0);
	gtk_widget_show(start_minutes);
	gtk_box_pack_start(GTK_BOX(hbox44), start_minutes, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(start_minutes), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(start_minutes), TRUE);

	start_seconds_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	start_seconds = gtk_spin_button_new(GTK_ADJUSTMENT(start_seconds_adj), 1, 0);
	gtk_widget_show(start_seconds);
	gtk_box_pack_start(GTK_BOX(hbox44), start_seconds, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(start_seconds), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(start_seconds), TRUE);

	hbox45 = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(hbox45);
	gtk_box_pack_start(GTK_BOX(hbox43), hbox45, TRUE, TRUE, 0);

	end_hours_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	end_hours = gtk_spin_button_new(GTK_ADJUSTMENT(end_hours_adj), 1, 0);
	gtk_widget_show(end_hours);
	gtk_box_pack_start(GTK_BOX(hbox45), end_hours, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(end_hours), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(end_hours), TRUE);

	end_minutes_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	end_minutes = gtk_spin_button_new(GTK_ADJUSTMENT(end_minutes_adj), 1, 0);
	gtk_widget_show(end_minutes);
	gtk_box_pack_start(GTK_BOX(hbox45), end_minutes, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(end_minutes), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(end_minutes), TRUE);

	end_seconds_adj = gtk_adjustment_new(0, -100, 100, 1, 10, 10);
	end_seconds = gtk_spin_button_new(GTK_ADJUSTMENT(end_seconds_adj), 1, 0);
	gtk_widget_show(end_seconds);
	gtk_box_pack_start(GTK_BOX(hbox45), end_seconds, TRUE, TRUE, 0);
	gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(end_seconds), TRUE);
	gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(end_seconds), TRUE);

	dialog_action_area4 = GTK_DIALOG(range_dialog)->action_area;
	gtk_widget_show(dialog_action_area4);
	gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area4), GTK_BUTTONBOX_END);

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

	ok_button = gtk_button_new();
	gtk_widget_show(ok_button);
	gtk_dialog_add_action_widget(GTK_DIALOG(range_dialog), ok_button, GTK_RESPONSE_OK);
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);

	alignment55 = gtk_alignment_new(0.5, 0.5, 0, 0);
	gtk_widget_show(alignment55);
	gtk_container_add(GTK_CONTAINER(ok_button), alignment55);

	hbox341 = gtk_hbox_new(FALSE, 2);
	gtk_widget_show(hbox341);
	gtk_container_add(GTK_CONTAINER(alignment55), hbox341);

	image49 = gtk_image_new_from_stock("gtk-ok", GTK_ICON_SIZE_BUTTON);
	gtk_widget_show(image49);
	gtk_box_pack_start(GTK_BOX(hbox341), image49, FALSE, FALSE, 0);

	label97 = gtk_label_new_with_mnemonic(_("Select Time Range"));
	gtk_widget_show(label97);
	gtk_box_pack_start(GTK_BOX(hbox341), label97, FALSE, FALSE, 0);

	g_signal_connect((gpointer) start_hours, "value_changed", 
			G_CALLBACK(cb_time_value_changed), NULL);
	g_signal_connect((gpointer) start_minutes, "value_changed", 
			G_CALLBACK(cb_time_value_changed), NULL);
	g_signal_connect((gpointer) start_seconds, "value_changed",
			G_CALLBACK(cb_time_value_changed), NULL);
	g_signal_connect((gpointer) end_hours, "value_changed",
			G_CALLBACK(cb_time_value_changed), NULL);
	g_signal_connect((gpointer) end_minutes, "value_changed",
			G_CALLBACK(cb_time_value_changed), NULL);
	g_signal_connect((gpointer) end_seconds, "value_changed",
			G_CALLBACK(cb_time_value_changed), NULL);

	val = g_strdup_printf("%02d", 0);
	gtk_entry_set_text(GTK_ENTRY(start_hours), val);
	gtk_entry_set_text(GTK_ENTRY(start_minutes), val);
	gtk_entry_set_text(GTK_ENTRY(start_seconds), val);
	gtk_entry_set_text(GTK_ENTRY(end_hours), val);
	gtk_entry_set_text(GTK_ENTRY(end_minutes), val);
	gtk_entry_set_text(GTK_ENTRY(end_seconds), val);
	g_free(val);

	gtk_widget_grab_default(ok_button);

	return range_dialog;
}
예제 #30
0
void xa_create_open_with_dialog(gchar *filename,gchar *filenames,int nr)
{
	Open_with_data *data = NULL;
	GtkWidget	*dialog_vbox1,*vbox1,*hbox1,*mime_icon,*open_text,*scrolledwindow1,*apps_treeview,*dialog_action_area1,
				*custom_command_expander,*hbox_expander,*browse,*cancelbutton1,*okbutton1;
	GtkCellRenderer		*renderer;
	GtkTreeViewColumn	*column;
	GtkTreeIter iter;
	GdkPixbuf *pixbuf;
	gchar *text = NULL;
	gchar *title;
	const gchar *icon_name = NULL;
	const gchar* const *desktop_dirs;
	gint x = 0;

	data = g_new0(Open_with_data,1);
	data->file_list = filenames;
	data->dialog1 = gtk_dialog_new ();
	if (nr == 1)
		title = _("Open With");
	else
		title = _("Open the selected files with");

	gtk_window_set_title (GTK_WINDOW (data->dialog1),title);
	gtk_window_set_position (GTK_WINDOW (data->dialog1), GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_modal (GTK_WINDOW (data->dialog1), TRUE);
	gtk_window_set_type_hint (GTK_WINDOW (data->dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);
	gtk_window_set_transient_for(GTK_WINDOW(data->dialog1),GTK_WINDOW(xa_main_window));
	gtk_dialog_set_has_separator (GTK_DIALOG (data->dialog1),FALSE);
	gtk_container_set_border_width (GTK_CONTAINER (data->dialog1),5);
	gtk_widget_set_size_request(data->dialog1,380,380);
	dialog_vbox1 = GTK_DIALOG (data->dialog1)->vbox;

	vbox1 = gtk_vbox_new (FALSE, 5);
	gtk_box_pack_start (GTK_BOX (dialog_vbox1),vbox1,TRUE,TRUE,0);

	hbox1 = gtk_hbox_new (FALSE, 1);
	gtk_box_pack_start (GTK_BOX (vbox1),hbox1,FALSE,FALSE,0);

	if (nr == 1)
	{
		icon_name = xa_get_stock_mime_icon(filename);
		pixbuf = gtk_icon_theme_load_icon(icon_theme,icon_name,40,0,NULL);
		mime_icon = gtk_image_new_from_pixbuf(pixbuf);
		if (pixbuf)
			g_object_unref(pixbuf);
		gtk_box_pack_start (GTK_BOX (hbox1),mime_icon,FALSE,TRUE,0);
		gtk_misc_set_alignment (GTK_MISC (mime_icon),0,0);

		open_text = gtk_label_new("");
		gtk_box_pack_start (GTK_BOX (hbox1),open_text,FALSE,FALSE,10);
		text = g_strdup_printf(_("Open <i>%s</i> with:"),filename);
		gtk_label_set_use_markup (GTK_LABEL (open_text),TRUE);
		gtk_label_set_markup (GTK_LABEL (open_text),text);
		g_free(text);
	}
	scrolledwindow1 = gtk_scrolled_window_new (NULL,NULL);
	gtk_box_pack_start (GTK_BOX (vbox1),scrolledwindow1,TRUE,TRUE,0);
	g_object_set (G_OBJECT (scrolledwindow1),"hscrollbar-policy",GTK_POLICY_AUTOMATIC,"shadow-type",GTK_SHADOW_IN,"vscrollbar-policy",GTK_POLICY_AUTOMATIC,NULL);

	data->apps_liststore = gtk_list_store_new (3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_STRING);
	apps_treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(data->apps_liststore));
	gtk_container_add (GTK_CONTAINER (scrolledwindow1),apps_treeview);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(apps_treeview),FALSE);
	GtkTreeSelection *sel = gtk_tree_view_get_selection( GTK_TREE_VIEW (apps_treeview));
	g_signal_connect ((gpointer) sel,"changed",G_CALLBACK (xa_open_with_dialog_selection_changed),data);

	/* First column: icon + text */
	column = gtk_tree_view_column_new();
	renderer = gtk_cell_renderer_pixbuf_new();
	gtk_tree_view_column_pack_start(column,renderer, FALSE);
	gtk_tree_view_column_set_attributes(column,renderer,"pixbuf",0,NULL);

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_column_pack_start(column,renderer, TRUE);
	gtk_tree_view_column_set_attributes( column,renderer,"text",1,NULL);
	gtk_tree_view_column_set_resizable (column, TRUE);
	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(data->apps_liststore),1,GTK_SORT_ASCENDING);
	gtk_tree_view_append_column (GTK_TREE_VIEW (apps_treeview), column);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);

	/* Hidden column with the application executable name */
	column = gtk_tree_view_column_new();
	gtk_tree_view_column_set_visible(column,FALSE);
	gtk_tree_view_append_column (GTK_TREE_VIEW (apps_treeview), column);

	custom_command_expander = gtk_expander_new_with_mnemonic(_("Use a custom command:"));
	gtk_box_pack_start (GTK_BOX (vbox1),custom_command_expander,FALSE,FALSE,0);

	hbox_expander = gtk_hbox_new(FALSE,5);

	data->custom_command_entry = gtk_entry_new();
	g_signal_connect (G_OBJECT (data->custom_command_entry),"activate",G_CALLBACK (xa_open_with_dialog_custom_entry_activated),data);

	browse = gtk_button_new_with_label(_("Browse"));
	g_signal_connect (G_OBJECT (browse),"clicked",G_CALLBACK (xa_open_with_dialog_browse_custom_command),data);

	gtk_box_pack_start (GTK_BOX (hbox_expander),data->custom_command_entry,TRUE,TRUE,0);
	gtk_box_pack_start (GTK_BOX (hbox_expander),browse,FALSE,TRUE,0);
	gtk_container_add(GTK_CONTAINER(custom_command_expander),hbox_expander);

	dialog_action_area1 = GTK_DIALOG (data->dialog1)->action_area;
	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 (data->dialog1),cancelbutton1,GTK_RESPONSE_CANCEL);
	GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
	g_signal_connect_swapped (G_OBJECT (cancelbutton1),"clicked",G_CALLBACK (gtk_widget_destroy),G_OBJECT(data->dialog1));

	okbutton1 = gtk_button_new_from_stock ("gtk-open");
	gtk_widget_show (okbutton1);
	gtk_dialog_add_action_widget (GTK_DIALOG (data->dialog1),okbutton1,GTK_RESPONSE_OK);
	g_signal_connect (G_OBJECT (okbutton1),"clicked",G_CALLBACK (xa_open_with_dialog_execute_command),data);
	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
	gtk_widget_show_all(data->dialog1);

	/* Let's parse the desktop files in all the system data dirs */
	desktop_dirs = g_get_system_data_dirs();
	while (desktop_dirs[x])
	{
		xa_read_desktop_directories(data->apps_liststore,desktop_dirs[x]);
		x++;
	}
	gtk_tree_model_get_iter_first(GTK_TREE_MODEL(data->apps_liststore),&iter);
	gtk_tree_selection_select_iter(gtk_tree_view_get_selection (GTK_TREE_VIEW (apps_treeview)),&iter);

	g_signal_connect (G_OBJECT (apps_treeview),	"row-activated",G_CALLBACK(xa_open_with_dialog_row_selected),data);
	g_signal_connect (G_OBJECT (data->dialog1),	"destroy",		G_CALLBACK(xa_destroy_open_with_dialog),data);
}