Пример #1
0
void bar_add(GtkWidget *bar, GtkWidget *pane)
{
	GtkWidget *expander;
	BarData *bd = g_object_get_data(G_OBJECT(bar), "bar_data");
	PaneData *pd = g_object_get_data(G_OBJECT(pane), "pane_data");

	if (!bd) return;

	pd->lw = bd->lw;
	pd->bar = bar;

	expander = gtk_expander_new(NULL);
	if (pd && pd->title)
		{
		gtk_expander_set_label_widget(GTK_EXPANDER(expander), pd->title);
		gtk_widget_show(pd->title);
		}

	gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);

	g_signal_connect(expander, "button_release_event", G_CALLBACK(bar_menu_cb), bd);
	g_signal_connect(expander, "notify::expanded", G_CALLBACK(bar_expander_cb), pd);

	gtk_container_add(GTK_CONTAINER(expander), pane);

	gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);

	gtk_widget_show(expander);

	if (bd->fd && pd && pd->pane_set_fd) pd->pane_set_fd(pane, bd->fd);

}
Пример #2
0
Файл: expander.c Проект: BYC/gtk
static void
test_click_content_widget (void)
{
  GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test click on content widget");
  GtkWidget *expander = gtk_expander_new ("Test Expander");
  GtkWidget *entry = gtk_entry_new ();
  gboolean expanded;
  gboolean simsuccess;
  gtk_container_add (GTK_CONTAINER (expander), entry);
  gtk_container_add (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window))), expander);
  gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
  gtk_widget_show (expander);
  gtk_widget_show (entry);
  gtk_widget_show_now (window);

  /* check click on content with expander open */
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (expanded);
  simsuccess = gtk_test_widget_click (entry, 1, 0);
  g_assert (simsuccess == TRUE);
  while (gtk_events_pending ()) /* let expander timeout/idle handlers update */
    gtk_main_iteration ();
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (expanded);
}
Пример #3
0
void    Amt::DetailImpl::activate__( const char* ){
	// stage one activation (after creation )
	_in_widget = gtk_expander_new("Детали");
	g_signal_connect(G_OBJECT(_in_widget), "activate", G_CALLBACK(activatedSt), this);
	_in_heightExp = 40;

}
Пример #4
0
Файл: expander.c Проект: BYC/gtk
static void
test_click_expander (void)
{
  GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test click on expander");
  GtkWidget *expander = gtk_expander_new ("Test Expander");
  GtkWidget *label = gtk_label_new ("Test Label");
  gboolean expanded;
  gboolean simsuccess;
  gtk_container_add (GTK_CONTAINER (expander), label);
  gtk_container_add (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window))), expander);
  gtk_widget_show (expander);
  gtk_widget_show (label);
  gtk_widget_show_now (window);
  /* check initial expander state */
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (!expanded);
  /* check expanding */
  simsuccess = gtk_test_widget_click (expander, 1, 0);
  g_assert (simsuccess == TRUE);
  while (gtk_events_pending ()) /* let expander timeout/idle handlers update */
    gtk_main_iteration ();
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (expanded);
  /* check collapsing */
  simsuccess = gtk_test_widget_click (expander, 1, 0);
  g_assert (simsuccess == TRUE);
  while (gtk_events_pending ()) /* let expander timeout/idle handlers update */
    gtk_main_iteration ();
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (!expanded);
}
Пример #5
0
void viewer_add_renderer (Viewer *self, Renderer *renderer, int priority)
{
    renderer->priority = priority;
    renderer->cmi      = gtk_check_menu_item_new_with_label (renderer->name);
    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (renderer->cmi), renderer->enabled);

    g_object_set_data (G_OBJECT (renderer->cmi), "Viewer:plugin", renderer);
    g_signal_connect (G_OBJECT (renderer->cmi), "toggled", 
                      G_CALLBACK (on_renderer_enabled_toggled), self);
    
    g_ptr_array_add(self->renderers, renderer);
    g_ptr_array_add(self->renderers_sorted, renderer);
    g_ptr_array_sort(self->renderers_sorted, renderer_name_compare_function);

    // What position in the sorted array is this item?
    unsigned int menu_idx = g_ptr_array_find_index(self->renderers_sorted, renderer);

    // add the menu item, accounting for the tear-off tab at index 0
    gtk_menu_shell_insert (GTK_MENU_SHELL (self->renderers_menu), renderer->cmi, menu_idx + 1);
    gtk_widget_show (renderer->cmi);

    // create a control widget
    if (renderer->widget) {
        g_ptr_array_add(self->renderers_sorted_with_controls, renderer);
        g_ptr_array_sort(self->renderers_sorted_with_controls, renderer_name_compare_function);

        unsigned int control_idx = g_ptr_array_find_index(self->renderers_sorted_with_controls, renderer);

        renderer->expander = gtk_expander_new (renderer->name);
        gtk_expander_set_expanded (GTK_EXPANDER (renderer->expander), TRUE);
        renderer->control_frame = gtk_frame_new (NULL);
        
        if (renderer->enabled) {
            gtk_widget_show (renderer->control_frame);
        } else {
            gtk_widget_hide (renderer->control_frame);
        }
        
        gtk_frame_set_label_widget (GTK_FRAME (renderer->control_frame), renderer->expander);
        gtk_container_add (GTK_CONTAINER (renderer->control_frame), renderer->widget);
        
        gtk_box_pack_start (GTK_BOX (self->controls_box), renderer->control_frame,
                            FALSE, TRUE, 0);
        gtk_box_reorder_child (GTK_BOX (self->controls_box), renderer->control_frame, control_idx);

        gtk_widget_show (renderer->expander);
        gtk_widget_show (renderer->widget);
        
        g_signal_connect (G_OBJECT (renderer->expander), "notify::expanded",
                          G_CALLBACK (on_renderer_widget_expander_notify), self);
        g_object_set_data (G_OBJECT (renderer->expander), 
                           "Viewer:plugin", renderer);
        g_object_set_data (G_OBJECT (renderer->widget), 
                           "Viewer:expander", renderer->expander);
        g_object_set_data (G_OBJECT (renderer->widget), 
                           "Viewer:frame", renderer->control_frame);
    }

    g_ptr_array_sort(self->renderers, sort_renderers_priority_decreasing);
}
Пример #6
0
static void
test_click_content_widget (void)
{
  GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test click on content widget");
  GtkWidget *expander = gtk_expander_new ("Test Expander");
  GtkWidget *entry = gtk_entry_new ();
  gboolean expanded;
  gboolean simsuccess;
  gtk_container_add (GTK_CONTAINER (expander), entry);
  gtk_container_add (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window))), expander);
  gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
  gtk_widget_show (expander);
  gtk_widget_show (entry);
  gtk_widget_show_now (window);

  /* check click on content with expander open */
  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (expanded);
  simsuccess = gtk_test_widget_click (entry, 1, 0);
  g_assert (simsuccess == TRUE);

  gtk_test_widget_wait_for_draw (expander);

  expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander));
  g_assert (expanded);
}
Пример #7
0
/* Helper function to add contacts label/edit widget pairs to a table,
 * with respect for structured field edits.
 */
void
contacts_append_to_edit_table (GtkTable *table, GtkWidget *label,
	GtkWidget *edit, gboolean do_focus)
{
	guint rows, cols;

	g_object_get (table, "n-rows", &rows, NULL);
	g_object_get (table, "n-columns", &cols, NULL);
	
	gtk_widget_show (label);
	gtk_widget_show (edit);
     	if (contacts_get_structured_field (
     	    gtk_widget_get_name (GTK_WIDGET (label)), 0)) {
     		GtkWidget *expander = gtk_expander_new (NULL);
     		GtkWidget *viewport = gtk_viewport_new (NULL, NULL);
     		gtk_expander_set_label_widget (GTK_EXPANDER (expander), label);
     		gtk_container_add (GTK_CONTAINER (viewport), edit);
     		gtk_widget_show (viewport);
     		gtk_container_add (GTK_CONTAINER (expander), viewport);
     		gtk_expander_set_expanded (GTK_EXPANDER (expander),
     					   TRUE);
     		gtk_widget_show (expander);
     		gtk_widget_set_name (expander, gtk_widget_get_name (edit));
     		/* Highlight selected field */
		if (do_focus) {
			expander = contacts_edit_add_focus_events (
				expander, NULL, NULL);
		}
     		gtk_table_attach (table,
     				  GTK_WIDGET (expander), 0, cols,
     				  rows, rows+1, GTK_FILL | GTK_EXPAND,
     				  GTK_FILL, 0, 0);
     	} else {
     		/* Hide the label when the entry is hidden */
		g_signal_connect_swapped (G_OBJECT (edit), "hide", 
					  G_CALLBACK (gtk_widget_hide),
					  label);

     		/* Highlight selected field */
		if (do_focus) {
			GList *l;
			GtkWidget *box = gtk_event_box_new ();
			gtk_container_add (GTK_CONTAINER (box), edit);
			gtk_widget_set_name (box, gtk_widget_get_name (edit));
			gtk_widget_show (box); 
			l = g_list_prepend (NULL, box);
			label = contacts_edit_add_focus_events (
				label, NULL, l);
			g_list_free (l);
			l = g_list_prepend (NULL, label);
			edit = contacts_edit_add_focus_events (edit, box, l);
			g_list_free (l);
		}
		
		gtk_table_attach (table, label,
			0, 1, rows, rows+1, GTK_FILL, GTK_FILL, 0, 0);
		gtk_table_attach (table, edit, 1, cols, rows, rows+1,
			GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
	}
}
Пример #8
0
bool PluginManageDlg::ShowModal(GtkWindow *parent_win, bool &dict_changed, bool &order_changed)
{
	window = gtk_dialog_new();
	oStarDictPluginSystemInfo.pluginwin = window;
	gtk_window_set_transient_for(GTK_WINDOW(window), parent_win);
	//gtk_dialog_set_has_separator(GTK_DIALOG(window), false);
	gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
	pref_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Configure Pl_ug-in"), STARDICT_RESPONSE_CONFIGURE);
	gtk_widget_set_sensitive(pref_button, FALSE);
	gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
	gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_CLOSE);
	g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(response_handler), this);
	GtkWidget *vbox;
#if GTK_MAJOR_VERSION >= 3
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
#else
	vbox = gtk_vbox_new (FALSE, 5);
#endif
	gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
	GtkWidget *pluginlist = create_plugin_list();
	gtk_box_pack_start (GTK_BOX (vbox), pluginlist, true, true, 0);
	GtkWidget *expander = gtk_expander_new (_("<b>Plug-in Details</b>"));
	gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE);
	gtk_box_pack_start (GTK_BOX (vbox), expander, false, false, 0);
	detail_label = gtk_label_new (NULL);
	gtk_label_set_line_wrap(GTK_LABEL(detail_label), TRUE);
	gtk_label_set_selectable(GTK_LABEL (detail_label), TRUE);
	gtk_container_add (GTK_CONTAINER (expander), detail_label);
	gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG (window))), vbox, true, true, 0);
	gtk_widget_show_all (gtk_dialog_get_content_area(GTK_DIALOG (window)));
	gtk_window_set_title (GTK_WINDOW (window), _("Manage Plugins"));
	gtk_window_set_default_size(GTK_WINDOW(window), 250, 350);
	dict_changed_ = false;
	order_changed_ = false;
	gint result;
	while (true) {
		result = gtk_dialog_run(GTK_DIALOG(window));
		if (result ==GTK_RESPONSE_HELP || result == STARDICT_RESPONSE_CONFIGURE) {
		} else {
			break;
		}
	}
	/* When do we get GTK_RESPONSE_NONE response? Unable to reproduce. */
	if (result != GTK_RESPONSE_NONE) {
		dict_changed = dict_changed_;
		order_changed = order_changed_;
		gtk_widget_destroy(GTK_WIDGET(window));
	}
	window = NULL;
	treeview = NULL;
	detail_label = NULL;
	pref_button = NULL;
	plugin_tree_model = NULL;
	oStarDictPluginSystemInfo.pluginwin = NULL;

	return result == GTK_RESPONSE_NONE;
}
Пример #9
0
  /* If ghidgui->use_command_window is TRUE this will get called from
     |  ActionCommand() to show the command window.
   */
void
ghid_command_window_show (gboolean raise)
{
  GtkWidget *vbox, *vbox1, *hbox, *button, *expander, *text;
  gint i;

  if (command_window)
    {
      if (raise)
        gtk_window_present (GTK_WINDOW(command_window));
      return;
    }
  command_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (command_window), "destroy",
		    G_CALLBACK (command_destroy_cb), NULL);
  gtk_window_set_title (GTK_WINDOW (command_window), _("PCB Command Entry"));
  gtk_window_set_wmclass (GTK_WINDOW (command_window), "PCB_Command", "PCB");
  gtk_window_set_resizable (GTK_WINDOW (command_window), FALSE);

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
  gtk_container_add (GTK_CONTAINER (command_window), vbox);

  if (!ghidgui->command_combo_box)
    command_combo_box_entry_create ();

  gtk_box_pack_start (GTK_BOX (vbox), ghidgui->command_combo_box,
		      FALSE, FALSE, 0);
  combo_vbox = vbox;

  /* Make the command reference scrolled text view.  Use high level
     |  utility functions in gui-utils.c
   */
  expander = gtk_expander_new (_("Command Reference"));
  gtk_box_pack_start (GTK_BOX (vbox), expander, TRUE, TRUE, 2);
  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (expander), vbox1);
  gtk_widget_set_size_request (vbox1, -1, 350);

  text = ghid_scrolled_text_view (vbox1, NULL,
				  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  for (i = 0; i < sizeof (command_ref_text) / sizeof (gchar *); ++i)
    ghid_text_view_append (text, _(command_ref_text[i]));

  /* The command window close button.
   */
  hbox = gtk_hbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
  g_signal_connect (G_OBJECT (button), "clicked",
		    G_CALLBACK (command_window_close_cb), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);

  gtk_widget_show_all (command_window);
}
Пример #10
0
void
doodle_add_dir_images (gchar *dir, GtkWidget *box)
{
    char base_name[255];
    get_base_name (dir, base_name, 255);
    GtkWidget *expander = gtk_expander_new (base_name);
    GtkWidget *table = doodle_add_images (dir);
    gtk_container_add (GTK_CONTAINER (expander), table);
    gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
    gtk_container_add (GTK_CONTAINER (box), expander);
}
Пример #11
0
static void
empathy_tls_dialog_constructed (GObject *object)
{
  GtkWidget *content_area, *expander, *details, *checkbox;
  gchar *text;
  EmpathyTLSDialog *self = EMPATHY_TLS_DIALOG (object);
  GtkMessageDialog *message_dialog = GTK_MESSAGE_DIALOG (self);
  GtkDialog *dialog = GTK_DIALOG (self);
  EmpathyTLSDialogPriv *priv = GET_PRIV (self);

  gtk_dialog_add_buttons (dialog,
      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
      _("C_ontinue"), GTK_RESPONSE_YES,
      NULL);

  text = reason_to_string (self);

  g_object_set (message_dialog,
      "title", _("Untrusted connection"),
      "text", _("This connection is untrusted. Would you like to "
          "continue anyway?"),
      "secondary-text", text,
      NULL);

  g_free (text);

  content_area = gtk_dialog_get_content_area (dialog);

  checkbox = gtk_check_button_new_with_label (
      _("Remember this choice for future connections"));
  gtk_box_pack_end (GTK_BOX (content_area), checkbox, FALSE, FALSE, 0);
  gtk_widget_show (checkbox);
  g_signal_connect (checkbox, "toggled", G_CALLBACK (checkbox_toggled_cb),
      self);

  text = g_strdup_printf ("<b>%s</b>", _("Certificate Details"));
  expander = gtk_expander_new (text);
  gtk_expander_set_use_markup (GTK_EXPANDER (expander), TRUE);
  gtk_box_pack_end (GTK_BOX (content_area), expander, TRUE, TRUE, 0);
  gtk_widget_show (expander);

  g_free (text);

  details = build_gcr_widget (self);
  gtk_container_add (GTK_CONTAINER (expander), details);
  gtk_widget_show (details);

  gtk_window_set_keep_above (GTK_WINDOW (self), TRUE);

  tp_g_signal_connect_object (priv->certificate, "invalidated",
      G_CALLBACK (certificate_invalidated_cb), self, 0);
}
GtkWidget *
gimp_color_profile_label_new (GimpColorProfile *profile)
{
  GtkWidget *expander;
  GtkWidget *view;

  g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);

  expander = gtk_expander_new (gimp_color_profile_get_label (profile));

  view = gimp_color_profile_view_new ();
  gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (view), profile);
  gtk_container_add (GTK_CONTAINER (expander), view);
  gtk_widget_show (view);

  return expander;
}
Пример #13
0
FormDialog::FormDialog (Ekiga::FormRequestPtr _request,
			GtkWidget *parent): request(_request)
{
  GtkWidget *vbox = NULL;

  rows = 0;
  advanced_rows = 0;

  window = gtk_dialog_new_with_buttons (NULL, GTK_WINDOW (NULL),
                                        GTK_DIALOG_MODAL,
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                        GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                        NULL);
  if (GTK_IS_WINDOW (parent))
    gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));

  gtk_dialog_set_default_response (GTK_DIALOG (window),
                                   GTK_RESPONSE_ACCEPT);
  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, FALSE, FALSE, 0);
  gtk_widget_show (vbox);

  preamble = gtk_vbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), preamble, FALSE, FALSE, 0);

  fields = gtk_table_new (0, 2, FALSE);
  gtk_table_set_row_spacings (GTK_TABLE (fields), 2);
  gtk_table_set_col_spacings (GTK_TABLE (fields), 2);
  gtk_box_pack_start (GTK_BOX (vbox), fields, FALSE, FALSE, 3);

  advanced_fields = gtk_table_new (0, 2, FALSE);
  gtk_table_set_row_spacings (GTK_TABLE (advanced_fields), 2);
  gtk_table_set_col_spacings (GTK_TABLE (advanced_fields), 2);
  expander = gtk_expander_new (_("Advanced"));
  gtk_container_add (GTK_CONTAINER (expander), advanced_fields);
  gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 3);

  labels_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
  options_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

  request->visit (*this);
}
Пример #14
0
static GtkWidget*
create_expander (const char *caption,
                 GtkWidget  *child,
                 gdouble     xscale,
                 gdouble     yscale)
{
  GtkWidget *expander = gtk_expander_new ("");
  GtkWidget *label = gtk_expander_get_label_widget (GTK_EXPANDER (expander));
  GtkWidget *align = gtk_alignment_new (0, 0, xscale, yscale);

  gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 18, 0);
  gtk_label_set_markup (GTK_LABEL (label), caption);

  gtk_container_add (GTK_CONTAINER (expander), align);
  gtk_container_add (GTK_CONTAINER (align), child);

  return expander;
}
Пример #15
0
GtkWidget *
do_expander (GtkWidget *do_widget)
{
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *expander;
  
  if (!window)
  {
    window = gtk_dialog_new_with_buttons ("GtkExpander",
					  GTK_WINDOW (do_widget),
					  0,
					  GTK_STOCK_CLOSE,
					  GTK_RESPONSE_NONE,
					  NULL);
    gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

    g_signal_connect (window, "response",
		      G_CALLBACK (gtk_widget_destroy), NULL);
    g_signal_connect (window, "destroy",
		      G_CALLBACK (gtk_widget_destroyed), &window);

    vbox = gtk_vbox_new (FALSE, 5);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);

    label = gtk_label_new ("Expander demo. Click on the triangle for details.");
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

    /* Create the expander */
    expander = gtk_expander_new ("Details");
    gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);

    label = gtk_label_new ("Details can be shown or hidden.");
    gtk_container_add (GTK_CONTAINER (expander), label);
  }

  if (!gtk_widget_get_visible (window))
    gtk_widget_show_all (window);
  else
    gtk_widget_destroy (window);

  return window;
}
Пример #16
0
void audgui_show_about_window (void)
{
    if (about_window)
    {
        gtk_window_present ((GtkWindow *) about_window);
        return;
    }

    const char * brief, * const * credits, * const * translators;
    aud_get_audacious_credits (& brief, & credits, & translators);

    about_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title ((GtkWindow *) about_window, _("About Audacious"));
    gtk_window_set_resizable ((GtkWindow *) about_window, FALSE);
    gtk_container_set_border_width ((GtkContainer *) about_window, 3);

    audgui_destroy_on_escape (about_window);
    g_signal_connect (about_window, "destroy", (GCallback) gtk_widget_destroyed,
     & about_window);

    GtkWidget * vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    gtk_container_add ((GtkContainer *) about_window, vbox);

    char * name = g_strdup_printf ("%s/images/about-logo.png", aud_get_path
     (AUD_PATH_DATA_DIR));
    GtkWidget * image = gtk_image_new_from_file (name);
    gtk_box_pack_start ((GtkBox *) vbox, image, FALSE, FALSE, 0);
    g_free (name);

    char * markup = g_strdup_printf (brief, VERSION);
    GtkWidget * label = gtk_label_new (NULL);
    gtk_label_set_markup ((GtkLabel *) label, markup);
    gtk_label_set_justify ((GtkLabel *) label, GTK_JUSTIFY_CENTER);
    gtk_box_pack_start ((GtkBox *) vbox, label, FALSE, FALSE, 0);
    g_free (markup);

    GtkWidget * exp = gtk_expander_new (_("Credits"));
    GtkWidget * notebook = create_credits_notebook (credits, translators);
    gtk_container_add ((GtkContainer *) exp, notebook);
    gtk_box_pack_start ((GtkBox *) vbox, exp, TRUE, TRUE, 0);

    gtk_widget_show_all (about_window);
}
Пример #17
0
GtkWidget*
pp_imagecontrol_new (Layout *layout)
{
	pp_ImageControl *ob=PP_IMAGECONTROL(g_object_new (pp_imagecontrol_get_type (), NULL));
	ob->layout=layout;

	GtkWidget *frame;

	// ImageInfo

	ob->imageinfo=pp_imageinfo_new(layout);
	gtk_box_pack_start(GTK_BOX(ob),ob->imageinfo,FALSE,FALSE,0);
	gtk_widget_show(ob->imageinfo);

	ob->histogram=pp_histogram_new(layout);
	gtk_box_pack_start(GTK_BOX(ob),ob->histogram,FALSE,FALSE,0);
	gtk_widget_show(ob->histogram);

	// FIXME add transformations here


	// FIXME add border selector here


	// EffectSelector

	ob->expander1=frame=gtk_expander_new(_("Effects"));
	g_signal_connect(ob->expander1, "notify::expanded",G_CALLBACK (expander_callback), ob);
	gtk_expander_set_expanded(GTK_EXPANDER(frame),layout->state.FindInt("ExpanderState_EffectSelector"));

	gtk_box_pack_start(GTK_BOX(ob),frame,TRUE,TRUE,0);
	gtk_widget_show(frame);

	ob->effectselector=effectselector_new();
	g_signal_connect(G_OBJECT(ob->effectselector),"changed",G_CALLBACK(effectselector_changed),ob);
	g_signal_connect(G_OBJECT(ob->effectselector),"addeffect",G_CALLBACK(effectselector_addeffect),ob);
	g_signal_connect(G_OBJECT(ob->effectselector),"removeeffect",G_CALLBACK(effectselector_removeeffect),ob);
	gtk_container_add(GTK_CONTAINER(frame),ob->effectselector);
	gtk_widget_show(ob->effectselector);

	return(GTK_WIDGET(ob));
}
Пример #18
0
void
ags_ffplayer_bridge_init(AgsFFPlayerBridge *ffplayer_bridge)
{
  GtkFrame *frame;
  GtkExpander *expander;
  GtkTable *table;

  AGS_EFFECT_BRIDGE(ffplayer_bridge)->input_pad_type = AGS_TYPE_FFPLAYER_INPUT_PAD;
  AGS_EFFECT_BRIDGE(ffplayer_bridge)->input_line_type = AGS_TYPE_FFPLAYER_INPUT_LINE;

  frame = (GtkFrame *) gtk_frame_new("input bridge");
  gtk_box_pack_start((GtkBox *) AGS_EFFECT_BRIDGE(ffplayer_bridge),
		     (GtkWidget *) frame,
		     FALSE, FALSE,
		     0);

  expander = (GtkExpander *) gtk_expander_new("show/hide");
  gtk_container_add((GtkContainer *) frame,
		    (GtkWidget *) expander);

  table = (GtkTable *) gtk_table_new(1, 2, FALSE);
  gtk_container_add((GtkContainer *) expander,
		    (GtkWidget *) table);

  AGS_EFFECT_BRIDGE(ffplayer_bridge)->bulk_input = (GtkWidget *) g_object_new(AGS_TYPE_FFPLAYER_BULK_INPUT,
									      NULL);
  gtk_table_attach(table,
		   (GtkWidget *) AGS_EFFECT_BRIDGE(ffplayer_bridge)->bulk_input,
		   0, 1,
		   0, 1,
		   GTK_FILL, GTK_FILL,
		   0, 0);
  
  AGS_EFFECT_BRIDGE(ffplayer_bridge)->input = (GtkHBox *) gtk_hbox_new(FALSE, 0);
  gtk_table_attach(table,
		   (GtkWidget *) AGS_EFFECT_BRIDGE(ffplayer_bridge)->input,
		   1, 2,
		   0, 1,
		   GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND,
		   0, 0);
}
static GtkWidget *gebr_gui_program_edit_load_parameter(GebrGuiProgramEdit  *program_edit,
						       GebrGeoXmlParameter *parameter,
						       GSList             **radio_group)
{
	GebrGeoXmlParameterType type;

	type = gebr_geoxml_parameter_get_type(parameter);
	if (type == GEBR_GEOXML_PARAMETER_TYPE_GROUP) {
		GtkWidget *expander;
		GtkWidget *label_widget;
		GtkWidget *label;
		GtkWidget *image_widget;

		GtkWidget *depth_hbox;
		GtkWidget *group_vbox;
		GtkWidget *instanciate_button;
		GtkWidget *deinstanciate_button;

		GebrGeoXmlParameterGroup *parameter_group;
		GebrGeoXmlSequence *instance;
		GebrGeoXmlSequence *param;
		gboolean required;

		parameter_group = GEBR_GEOXML_PARAMETER_GROUP(parameter);

		expander = gtk_expander_new("");
		image_widget = gtk_image_new();
		program_edit->group_warning_widget = image_widget;

		gtk_widget_show(expander);
		gtk_expander_set_expanded(GTK_EXPANDER(expander),
					  gebr_geoxml_parameter_group_get_expand(parameter_group));

		label_widget = gtk_hbox_new(FALSE, 0);
		gtk_widget_show(label_widget);
		gtk_expander_set_label_widget(GTK_EXPANDER(expander), label_widget);
		gebr_gui_gtk_expander_hacked_define(expander, label_widget);

		GebrGeoXmlParameters *template;
Пример #20
0
static GtkWidget* radare_gui_panel_load (RadareGUIPanel* self) {
	GtkVBox* vb;
#line 21 "panel.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 23 "panel.vala"
	self->priv->radgets = g_slist_append (self->priv->radgets, ((RadareGUIRadget*) (radare_gui_radget_information_new ())));
#line 24 "panel.vala"
	self->priv->radgets = g_slist_append (self->priv->radgets, ((RadareGUIRadget*) (radare_gui_radget_search_new ())));
#line 25 "panel.vala"
	self->priv->radgets = g_slist_append (self->priv->radgets, ((RadareGUIRadget*) (radare_gui_radget_debugger_new ())));
	vb = g_object_ref_sink (((GtkVBox*) (gtk_vbox_new (FALSE, 5))));
	{
		GSList* r_collection;
		GSList* r_it;
#line 29 "panel.vala"
		r_collection = self->priv->radgets;
		for (r_it = r_collection; r_it != NULL; r_it = r_it->next) {
			RadareGUIRadget* _tmp0;
			RadareGUIRadget* r;
#line 6 "panel.vala"
			_tmp0 = NULL;
#line 29 "panel.vala"
			r = (_tmp0 = ((RadareGUIRadget*) (r_it->data)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
			{
				GtkExpander* ex;
				ex = g_object_ref_sink (((GtkExpander*) (gtk_expander_new (radare_gui_radget_get_name (r)))));
#line 31 "panel.vala"
				gtk_container_add (((GtkContainer*) (ex)), ((GtkWidget*) (radare_gui_radget_get_box (r))));
#line 32 "panel.vala"
				gtk_box_pack_start (((GtkBox*) (vb)), ((GtkWidget*) (ex)), FALSE, FALSE, ((guint) (0)));
				(r == NULL ? NULL : (r = (g_object_unref (r), NULL)));
				(ex == NULL ? NULL : (ex = (g_object_unref (ex), NULL)));
			}
		}
	}
#line 35 "panel.vala"
	return ((GtkWidget*) (vb));
}
Пример #21
0
static GtkWidget*
create_expander (const char *caption,
                 GtkWidget  *child,
                 GtkAlign    halign,
                 GtkAlign    valign)
{
  GtkWidget *expander = gtk_expander_new ("");
  GtkWidget *label = gtk_expander_get_label_widget (GTK_EXPANDER (expander));

  g_object_set (child,
                "margin-top", 6,
                "margin-bottom", 0,
                "margin-start", 18,
                "margin-end", 0,
                "halign", halign,
                "valign", valign,
                NULL);
  gtk_label_set_markup (GTK_LABEL (label), caption);

  gtk_container_add (GTK_CONTAINER (expander), child);

  return expander;
}
Пример #22
0
static GtkWidget *
create_window (void)
{
  GtkWidget *window, *hbox, *vbox, *flowbox_cntl, *items_cntl;
  GtkWidget *flowbox, *widget, *expander, *swindow;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  hbox   = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
  vbox   = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);

  gtk_container_set_border_width (GTK_CONTAINER (window), 8);

  gtk_widget_show (vbox);
  gtk_widget_show (hbox);
  gtk_container_add (GTK_CONTAINER (window), hbox);
  gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

  swindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

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

  flowbox = gtk_flow_box_new ();
  gtk_widget_set_halign (flowbox, GTK_ALIGN_END);
  the_flowbox = (GtkFlowBox *)flowbox;
  gtk_widget_set_halign (flowbox, INITIAL_HALIGN);
  gtk_widget_set_valign (flowbox, INITIAL_VALIGN);
  gtk_flow_box_set_column_spacing (GTK_FLOW_BOX (flowbox), INITIAL_CSPACING);
  gtk_flow_box_set_row_spacing (GTK_FLOW_BOX (flowbox), INITIAL_RSPACING);
  gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MINIMUM_LENGTH);
  gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MAXIMUM_LENGTH);
  gtk_widget_show (flowbox);
  gtk_container_add (GTK_CONTAINER (swindow), flowbox);

  gtk_flow_box_set_hadjustment (GTK_FLOW_BOX (flowbox),
                                gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (swindow)));
  gtk_flow_box_set_vadjustment (GTK_FLOW_BOX (flowbox),
                                gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (swindow)));

  g_signal_connect (flowbox, "child-activated", G_CALLBACK (on_child_activated), NULL);
  g_signal_connect (flowbox, "selected-children-changed", G_CALLBACK (on_selected_children_changed), NULL);

  /* Add Flowbox test control frame */
  expander = gtk_expander_new ("Flow Box controls");
  gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
  flowbox_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
  gtk_widget_show (flowbox_cntl);
  gtk_widget_show (expander);
  gtk_container_add (GTK_CONTAINER (expander), flowbox_cntl);
  gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);

  widget = gtk_check_button_new_with_label ("Homogeneous");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (homogeneous_toggled), flowbox);

  widget = gtk_check_button_new_with_label ("Activate on single click");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  g_object_bind_property (widget, "active",
                          flowbox, "activate-on-single-click",
                          G_BINDING_SYNC_CREATE);
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  /* Add alignment controls */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Fill");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Start");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "End");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Center");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_HALIGN);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the horizontal alignment policy");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (horizontal_alignment_changed), flowbox);

  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Fill");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Start");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "End");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Center");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_VALIGN);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the vertical alignment policy");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (vertical_alignment_changed), flowbox);

  /* Add Orientation control */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the flowbox orientation");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (orientation_changed), flowbox);

  /* Add selection mode control */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "None");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Single");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Browse");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Multiple");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the selection mode");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (selection_mode_changed), flowbox);

  /* Add minimum line length in items control */
  widget = gtk_spin_button_new_with_range (1, 10, 1);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MINIMUM_LENGTH);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the minimum amount of items per line before wrapping");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (line_length_changed), flowbox);
  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (line_length_changed), flowbox);

  /* Add natural line length in items control */
  widget = gtk_spin_button_new_with_range (1, 10, 1);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MAXIMUM_LENGTH);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the natural amount of items per line ");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (max_line_length_changed), flowbox);
  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (max_line_length_changed), flowbox);

  /* Add horizontal/vertical spacing controls */
  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
  gtk_widget_show (hbox);

  widget = gtk_label_new ("H Spacing");
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);

  widget = gtk_spin_button_new_with_range (0, 30, 1);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_CSPACING);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children");
  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));
  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));

  gtk_box_pack_start (GTK_BOX (flowbox_cntl), hbox, FALSE, FALSE, 0);

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
  gtk_widget_show (hbox);

  widget = gtk_label_new ("V Spacing");
  gtk_widget_show (widget);
  gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);

  widget = gtk_spin_button_new_with_range (0, 30, 1);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_RSPACING);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children");
  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));
  g_signal_connect (G_OBJECT (widget), "value-changed",
                    G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));

  gtk_box_pack_start (GTK_BOX (flowbox_cntl), hbox, FALSE, FALSE, 0);

  /* filtering and sorting */

  widget = gtk_check_button_new_with_label ("Filter");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (filter_toggled), flowbox);

  widget = gtk_check_button_new_with_label ("Sort");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted");
  gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "toggled",
                    G_CALLBACK (sort_toggled), flowbox);


  /* Add test items control frame */
  expander = gtk_expander_new ("Test item controls");
  gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
  items_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
  gtk_widget_show (items_cntl);
  gtk_widget_show (expander);
  gtk_container_add (GTK_CONTAINER (expander), items_cntl);
  gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);

  /* Add Items control */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Simple");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Focus");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Wrappy");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Stock");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Images");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the item set to use");
  gtk_box_pack_start (GTK_BOX (items_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (items_changed), flowbox);


  /* Add Text Orientation control */
  widget = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
  gtk_widget_show (widget);

  gtk_widget_set_tooltip_text (widget, "Set the item's text orientation (cant be done for stock buttons)");
  gtk_box_pack_start (GTK_BOX (items_cntl), widget, FALSE, FALSE, 0);

  g_signal_connect (G_OBJECT (widget), "changed",
                    G_CALLBACK (text_orientation_changed), flowbox);

  populate_items (GTK_FLOW_BOX (flowbox));

  /* This line was added only for the convenience of reproducing
   * a height-for-width inside GtkScrolledWindow bug (bug 629778).
   *   -Tristan
   */
  gtk_window_set_default_size (GTK_WINDOW (window), 390, -1);

  return window;
}
Пример #23
0
GtkWidget *addTitle(gchar *temp)
{
    GtkWidget *exp = gtk_expander_new (temp);
    gtk_expander_set_spacing(GTK_EXPANDER(exp), 5);
    return exp;
}
Пример #24
0
static void
gwy_app_file_chooser_add_type_list(GwyAppFileChooser *chooser)
{
    GtkWidget *vbox, *scwin;
    GtkTreeView *treeview;
    GtkFileChooserAction action;
    GtkRequisition req;
    GtkTreeSelection *selection;
    GtkTreeViewColumn *column;
    GtkCellRenderer *renderer;
    GtkListStore *store;
    GtkTreeIter iter;
    gboolean expanded = FALSE;
    gboolean filter = FALSE;
    gchar *key;

    g_object_get(chooser, "action", &action, NULL);

    key = g_strconcat(chooser->prefix, "/type", NULL);
    chooser->type_key = g_quark_from_string(key);
    g_free(key);

    store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
    gtk_list_store_append(store, &iter);
    switch (action) {
        case GTK_FILE_CHOOSER_ACTION_SAVE:
        gtk_list_store_set(store, &iter,
                           COLUMN_FILETYPE, "",
                           COLUMN_LABEL, _("Automatic by extension"),
                           -1);
        gwy_app_file_chooser_add_types(store, GWY_FILE_OPERATION_SAVE);
        gwy_app_file_chooser_add_types(store, GWY_FILE_OPERATION_EXPORT);
        break;

        case GTK_FILE_CHOOSER_ACTION_OPEN:
        gtk_list_store_set(store, &iter,
                           COLUMN_FILETYPE, "",
                           COLUMN_LABEL, _("Automatically detected"),
                           -1);
        gwy_app_file_chooser_add_types(store, GWY_FILE_OPERATION_LOAD);
        break;

        default:
        g_assert_not_reached();
        break;
    }

    chooser->expander = gtk_expander_new(NULL);
    gtk_expander_set_use_underline(GTK_EXPANDER(chooser->expander), TRUE);
    gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(chooser),
                                      chooser->expander);
    key = g_strconcat(chooser->prefix, "/expanded", NULL);
    gwy_container_gis_boolean_by_name(gwy_app_settings_get(), key, &expanded);
    g_free(key);
    gtk_expander_set_expanded(GTK_EXPANDER(chooser->expander), expanded);
    g_signal_connect_swapped(chooser->expander, "notify::expanded",
                             G_CALLBACK(gwy_app_file_chooser_expanded),
                             chooser);

    vbox = gtk_vbox_new(FALSE, 4);
    gtk_container_add(GTK_CONTAINER(chooser->expander), vbox);

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

    chooser->type_list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
    treeview = GTK_TREE_VIEW(chooser->type_list);
    g_object_unref(store);
    gtk_tree_view_set_headers_visible(treeview, FALSE);
    gtk_container_add(GTK_CONTAINER(scwin), chooser->type_list);

    column = gtk_tree_view_column_new();
    gtk_tree_view_append_column(treeview, column);
    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(column), renderer, TRUE);
    gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(column), renderer,
                                  "text", COLUMN_LABEL);

    selection = gtk_tree_view_get_selection(treeview);
    gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
    g_signal_connect_swapped(selection, "changed",
                             G_CALLBACK(gwy_app_file_chooser_type_changed),
                             chooser);

    if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
        chooser->filter_enable
            = gtk_check_button_new_with_mnemonic(_("Show only loadable "
                                                   "files of selected type"));
        key = g_strconcat(chooser->prefix, "/filter", NULL);
        gwy_container_gis_boolean_by_name(gwy_app_settings_get(), key, &filter);
        g_free(key);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chooser->filter_enable),
                                     filter);
        gtk_box_pack_start(GTK_BOX(vbox), chooser->filter_enable,
                           FALSE, FALSE, 0);
        g_signal_connect_swapped(chooser->filter_enable, "toggled",
                                 G_CALLBACK(gwy_app_file_chooser_filter_toggled),
                                 chooser);
        gwy_app_file_chooser_filter_toggled(chooser,
                                            GTK_TOGGLE_BUTTON(chooser->filter_enable));
    }

    /* Give it some reasonable size. FIXME: hack. */
    gtk_widget_show_all(vbox);
    gtk_widget_size_request(scwin, &req);
    gtk_widget_set_size_request(scwin, -1, 3*req.height + 20);

    gwy_app_file_chooser_select_type(chooser);
    gwy_app_file_chooser_type_changed(chooser, selection);
}
void
ags_replicator_bridge_init(AgsReplicatorBridge *replicator_bridge)
{
  GtkVBox *vbox;
  GtkExpander *expander;
  GtkTable *table;

  AgsAudio *audio;

  audio = AGS_MACHINE(replicator_bridge)->audio;
  audio->flags |= (AGS_AUDIO_OUTPUT_HAS_RECYCLING |
		   AGS_AUDIO_INPUT_HAS_RECYCLING |
		   AGS_AUDIO_SYNC |
		   AGS_AUDIO_ASYNC);

  AGS_MACHINE(replicator_bridge)->input_pad_type = G_TYPE_NONE;
  AGS_MACHINE(replicator_bridge)->input_line_type = G_TYPE_NONE;
  AGS_MACHINE(replicator_bridge)->output_pad_type = G_TYPE_NONE;
  AGS_MACHINE(replicator_bridge)->output_line_type = G_TYPE_NONE;

  g_signal_connect_after(G_OBJECT(AGS_MACHINE(replicator_bridge)->audio), "set-audio-channels\0",
			 G_CALLBACK(ags_replicator_bridge_set_audio_channels), replicator_bridge);

  g_signal_connect_after(G_OBJECT(AGS_MACHINE(replicator_bridge)->audio), "set-pads\0",
			 G_CALLBACK(ags_replicator_bridge_set_pads), replicator_bridge);

  /* create widgets */
  vbox = (GtkVBox *) gtk_vbox_new(FALSE, 0);
  gtk_container_add((GtkContainer *) (gtk_bin_get_child((GtkBin *) replicator_bridge)),
		    (GtkWidget *) vbox);


  /* replicator_bridge */
  expander = (GtkExpander *) gtk_expander_new("conversion matrix\0");
  gtk_box_pack_start((GtkBox *) vbox,
		     (GtkWidget *) expander,
		     FALSE, FALSE,
		     0);

  table = (GtkTable *) gtk_table_new(2, 2,
				     FALSE);;
  gtk_container_add((GtkContainer *) expander,
		    (GtkWidget *) table);


  replicator_bridge->h_label = (GtkTable *) gtk_table_new(1, 1,
							  FALSE);
  gtk_table_attach(table,
		   replicator_bridge->h_label,
		   0, 1,
		   1, 2,
		   GTK_FILL, GTK_FILL,
		   0, 0);
  
  replicator_bridge->v_label = (GtkTable *) gtk_table_new(1, 1,
							 FALSE);
  gtk_table_attach(table,
		   replicator_bridge->v_label,
		   1, 2,
		   0, 1,
		   GTK_FILL, GTK_FILL,
		   0, 0);
    
  replicator_bridge->matrix = (GtkTable *) gtk_table_new(1, 1,
							 FALSE);
  gtk_table_attach(table,
		   replicator_bridge->matrix,
		   0, 1,
		   0, 1,
		   GTK_FILL, GTK_FILL,
		   0, 0);
}
Пример #26
0
GtkWidget* create_window (void) {
	GtkWidget *window, *box_all, *expander, *expander_box_all, *expander_box_buttons, *separator, *box_buttons, *button_quit, *button_about;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (window), "Gcolor3");
	gtk_window_set_default_icon_name ("gcolor2");
	g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

	box_all = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
	gtk_container_set_border_width (GTK_CONTAINER (box_all), 5);
	box_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	gtk_container_set_border_width (GTK_CONTAINER (box_buttons), 5);

	color_chooser = gtk_color_selection_new();
	expander = gtk_expander_new(_("Show saved colors"));
	expander_box_all = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
	expander_box_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	button_save = gtk_button_new_from_stock ("gtk-save");
	button_delete = gtk_button_new_from_stock ("gtk-delete");
	gtk_widget_set_sensitive (button_delete, FALSE);

	/* setup the tree view widget */
	liststore = gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
	tree = gtk_tree_view_new();
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree), TRUE);
	gtk_tree_view_set_model (GTK_TREE_VIEW (tree), GTK_TREE_MODEL (liststore));

	column = gtk_tree_view_column_new ();
	gtk_tree_view_column_set_title (column, _("Color"));

	renderer = gtk_cell_renderer_pixbuf_new ();
	gtk_tree_view_column_pack_start (column, renderer, FALSE);
	gtk_tree_view_column_set_attributes (column, renderer, "pixbuf", COLOR, 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", COLOR_VALUE, NULL);

	gtk_tree_view_column_set_sort_column_id (column, COLOR_VALUE);
	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);

	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, "text", COLOR_NAME, NULL);
	gtk_tree_view_column_set_sort_column_id (column, COLOR_NAME);
	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);

	/* enable searching on Name column */
	gtk_tree_view_set_search_column (GTK_TREE_VIEW (tree), COLOR_NAME);

	/* setup the selection handler */
	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);

	separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	button_quit = gtk_button_new_from_stock ("gtk-quit");
	button_about = gtk_button_new_from_stock ("gtk-about");

	gtk_box_pack_start (GTK_BOX (box_all), color_chooser, TRUE, TRUE, 0);
	gtk_box_pack_end (GTK_BOX (expander_box_buttons), button_save, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (expander_box_buttons), button_delete, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (expander_box_all), expander_box_buttons, TRUE, TRUE, 0);
	gtk_box_pack_start (GTK_BOX (expander_box_all), tree, TRUE, TRUE, 0);
	gtk_container_add (GTK_CONTAINER (expander), expander_box_all);
	gtk_box_pack_start (GTK_BOX (box_all), expander, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (box_all), separator, TRUE, TRUE, 0);
	gtk_box_pack_end (GTK_BOX (box_buttons), button_quit, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (box_buttons), button_about, FALSE, FALSE, 0);

	g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (on_list_selection_changed), NULL);
	g_signal_connect ((gpointer) color_chooser, "color_changed", G_CALLBACK (on_colorselection_color_changed), NULL);
	g_signal_connect (button_save, "clicked", G_CALLBACK (on_save_button_clicked), NULL);
	g_signal_connect (button_delete, "clicked", G_CALLBACK (on_delete_button_clicked), NULL);
	g_signal_connect (button_quit, "clicked", G_CALLBACK (gtk_main_quit), NULL);
	g_signal_connect (button_about, "clicked", G_CALLBACK (about_dialog_open), NULL);

	gtk_container_add (GTK_CONTAINER (box_all), box_buttons);
	gtk_container_add (GTK_CONTAINER (window), box_all);

	return window;
}
Пример #27
0
int
fe_dcc_open_recv_win (int passive)
{
	GtkWidget *radio, *table, *vbox, *bbox, *view, *exp, *detailbox;
	GtkListStore *store;
	GSList *group;
	if (dccfwin.window)
	{
		if (!passive)
			mg_bring_tofront (dccfwin.window);
		return TRUE;
	}
	dccfwin.window = mg_create_generic_tab ("Transfers", _("conspire: Uploads and Downloads"),
														 FALSE, TRUE, close_dcc_file_window, NULL,
														 win_width, win_height, &vbox, 0);
	gtk_container_set_border_width (GTK_CONTAINER (dccfwin.window), 3);
	gtk_box_set_spacing (GTK_BOX (vbox), 3);

	store = gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
										 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
										 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
										 G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR);
	view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1);
	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
	/* Up/Down Icon column */
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, NULL,
																gtk_cell_renderer_pixbuf_new (),
																"pixbuf", COL_TYPE, NULL);
	dcc_add_column (view, COL_STATUS, COL_COLOR, _("Status"), FALSE);
	dcc_add_column (view, COL_FILE,   COL_COLOR, _("File"), FALSE);
	dcc_add_column (view, COL_SIZE,   COL_COLOR, _("Size"), TRUE);
	dcc_add_column (view, COL_POS,    COL_COLOR, _("Position"), TRUE);
	dcc_add_column (view, COL_PERC,   COL_COLOR, "%", TRUE);
	dcc_add_column (view, COL_SPEED,  COL_COLOR, "KB/s", TRUE);
	dcc_add_column (view, COL_ETA,    COL_COLOR, _("ETA"), FALSE);
	dcc_add_column (view, COL_NICK,   COL_COLOR, _("Nick"), FALSE);

	dccfwin.list = view;
	dccfwin.store = store;
	dccfwin.sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
	view_mode = VIEW_BOTH;
	gtk_tree_selection_set_mode (dccfwin.sel, GTK_SELECTION_MULTIPLE);

	if (!prefs.windows_as_tabs)
		g_signal_connect (G_OBJECT (dccfwin.window), "configure_event",
								G_CALLBACK (dcc_configure_cb), 0);
	g_signal_connect (G_OBJECT (dccfwin.sel), "changed",
							G_CALLBACK (dcc_row_cb), NULL);
	/* double click */
	g_signal_connect (G_OBJECT (view), "row-activated",
							G_CALLBACK (dcc_dclick_cb), NULL);

	table = gtk_table_new (1, 3, FALSE);
	gtk_table_set_col_spacings (GTK_TABLE (table), 16);
	gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0);

	radio = gtk_radio_button_new_with_mnemonic (NULL, _("Both"));
	g_signal_connect (G_OBJECT (radio), "toggled",
							G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_BOTH));
	gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));

	radio = gtk_radio_button_new_with_mnemonic (group, _("Uploads"));
	g_signal_connect (G_OBJECT (radio), "toggled",
							G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_UPLOAD));
	gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
	group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));

	radio = gtk_radio_button_new_with_mnemonic (group, _("Downloads"));
	g_signal_connect (G_OBJECT (radio), "toggled",
							G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_DOWNLOAD));
	gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);

	exp = gtk_expander_new (_("Details"));
	gtk_table_attach (GTK_TABLE (table), exp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);

	detailbox = gtk_table_new (3, 3, FALSE);
	gtk_table_set_col_spacings (GTK_TABLE (detailbox), 6);
	gtk_table_set_row_spacings (GTK_TABLE (detailbox), 2);
	gtk_container_set_border_width (GTK_CONTAINER (detailbox), 6);
	g_signal_connect (G_OBJECT (exp), "activate",
							G_CALLBACK (dcc_exp_cb), detailbox);
	gtk_table_attach (GTK_TABLE (table), detailbox, 0, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);

	dccfwin.file_label = dcc_detail_label (_("File:"), detailbox, 0);
	dccfwin.address_label = dcc_detail_label (_("Address:"), detailbox, 1);

	bbox = gtk_hbutton_box_new ();
	gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
	gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2);

	dccfwin.abort_button = gtkutil_button (bbox, GTK_STOCK_CANCEL, 0, abort_clicked, 0, _("Abort"));
	dccfwin.accept_button = gtkutil_button (bbox, GTK_STOCK_APPLY, 0, accept_clicked, 0, _("Accept"));
	dccfwin.resume_button = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, resume_clicked, 0, _("Resume"));
	dccfwin.open_button = gtkutil_button (bbox, 0, 0, browse_dcc_folder, 0, _("Open Folder..."));
	gtk_widget_set_sensitive (dccfwin.accept_button, FALSE);
	gtk_widget_set_sensitive (dccfwin.resume_button, FALSE);
	gtk_widget_set_sensitive (dccfwin.abort_button, FALSE);

	dcc_fill_window (3);
	gtk_widget_show_all (dccfwin.window);
	gtk_widget_hide (detailbox);

	return FALSE;
}
Пример #28
0
void traitement_sigsegv ( gint signal_nb )
{
    gchar *gsb_file_default_dir;
    gchar *errmsg = g_strdup ( "" );
	gchar *old_errmsg;
    gchar *tmpstr;
    GtkWidget * dialog;
#ifdef HAVE_BACKTRACE
    GtkWidget * expander;
#endif

    /*   il y a 3 possibilités : */
    /*     soit on était en train de charger un fichier, c'est que celui-ci est corrompu */
    /* soit on était en train de sauver un fichier, et là on peut rien faire */
    /* sinon on essaie de sauver le fichier sous le nom entouré de # */

    if ( run.is_loading || 
	 run.is_saving || 
	 !gsb_file_get_modified ( ) )
    {

	if ( run.is_loading )
	{
	    old_errmsg = errmsg;
	    errmsg = g_strconcat ( errmsg, _("File is corrupted."), NULL );
	    g_free ( old_errmsg );
	}

	if ( run.is_saving )
	{
	    old_errmsg = errmsg;
	    errmsg = g_strconcat ( errmsg, _("Error occured saving file."), NULL );
	    g_free ( old_errmsg );
	}
    }
    else 
    {
	/* c'est un bug pendant le fonctionnement de Grisbi s'il n'y a
	   pas de nom de fichier, on le crée, sinon on rajoute #
	   autour */

        gsb_file_default_dir = (gchar *) my_get_gsb_file_default_dir();

	if ( nom_fichier_comptes )
	    /* set # around the filename */
	    nom_fichier_comptes = g_path_get_basename (nom_fichier_comptes);
	else
	    /* no name for the file, create it */
	    nom_fichier_comptes = g_strconcat ( gsb_file_default_dir,
						"/#grisbi_crash_no_name#",
						NULL );

	gsb_status_message ( _("Save file") );

	gsb_file_save_save_file ( nom_fichier_comptes,
				  conf.compress_file,
				  FALSE );

	gsb_status_clear();

    old_errmsg = errmsg;
	errmsg = g_strconcat ( errmsg, 
			       g_strdup_printf ( _("Grisbi made a backup file at '%s'."),
						 nom_fichier_comptes ),
			       NULL );
	g_free ( old_errmsg );
    }

    old_errmsg = errmsg;
    errmsg = g_strconcat ( errmsg, 
			   "\n\n",
			   _("Please report this problem to <tt>http://www.grisbi.org/bugtracking/</tt>.  "),
			   NULL );
     g_free ( old_errmsg );

#ifdef HAVE_BACKTRACE
    old_errmsg = errmsg;
    errmsg = g_strconcat ( errmsg, _("Copy and paste the following backtrace with your bug "
                        "report."),
			   NULL );
     g_free ( old_errmsg );
#endif

    dialog = dialogue_special_no_run ( GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
				       make_hint ( _("Grisbi terminated due to a segmentation fault."),
						   errmsg ));
    g_free ( errmsg );

#ifdef HAVE_BACKTRACE
    tmpstr = g_strconcat ( "<b>", _("Backtrace"), "</b>", NULL );
    expander = gtk_expander_new ( tmpstr );
    g_free ( tmpstr );

    gtk_expander_set_use_markup ( GTK_EXPANDER ( expander ), TRUE );
    gtk_container_add ( GTK_CONTAINER ( expander ), print_backtrace() );
    gtk_box_pack_start ( GTK_BOX ( GTK_DIALOG(dialog)->vbox ), expander, FALSE, FALSE, 6 );

    gtk_widget_show_all ( dialog );
#endif
    gtk_dialog_run ( GTK_DIALOG ( dialog ) );

    /*     on évite le message du fichier ouvert à la prochaine ouverture */

    gsb_file_util_modify_lock ( FALSE );

    exit(1);
}
Пример #29
0
static void create_main_win()
{
  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(main_window), GTK_WIN_POS_CENTER);

  gtk_window_set_has_resize_grip(GTK_WINDOW(main_window), FALSE);

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

  set_window_gcin_icon(main_window);

  GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (main_window), vbox);

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

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

  GtkWidget *button_gtab_conf = gtk_button_new_with_label(_(_L("倉頡/行列/嘸蝦米/大易設定")));
  gtk_box_pack_start (GTK_BOX (vbox), button_gtab_conf, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_gtab_conf), "clicked",
                    G_CALLBACK (cb_gtab_conf), NULL);

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

    GCIN_module_callback_functions *f = init_GCIN_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, _(_L("設定")));
    GtkWidget *button_chewing_input_method = gtk_button_new_with_label(tt);
    gtk_box_pack_start (GTK_BOX (vbox), button_chewing_input_method, TRUE, TRUE, 0);
    g_signal_connect (G_OBJECT (button_chewing_input_method), "clicked",
                    G_CALLBACK (f->module_setup_window_create), NULL);
  }

  GtkWidget *button_default_input_method = gtk_button_new_with_label(_(_L("內定輸入法 & 開啟/關閉")));
  gtk_box_pack_start (GTK_BOX (vbox), button_default_input_method, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_default_input_method), "clicked",
                    G_CALLBACK (cb_default_input_method), NULL);


  GtkWidget *button_alt_shift = gtk_button_new_with_label(_(_L("alt-shift 片語編輯")));
  gtk_box_pack_start (GTK_BOX (vbox), button_alt_shift, TRUE, TRUE, 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(_(_L("符號表編輯")));
  gtk_box_pack_start (GTK_BOX (vbox), button_symbol_table, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_symbol_table), "clicked",
                    G_CALLBACK (cb_symbol_table), NULL);

#if TRAY_ENABLED
  if (!gcin_status_tray)
  {
#endif
    GtkWidget *button_gb_output_toggle = gtk_button_new_with_label(_(_L("簡體字輸出切換")));
    gtk_box_pack_start (GTK_BOX (vbox), button_gb_output_toggle, TRUE, TRUE, 0);
    g_signal_connect (G_OBJECT (button_gb_output_toggle), "clicked",
                      G_CALLBACK (cb_gb_output_toggle), NULL);
#if TRAY_ENABLED
  }
#endif

  GtkWidget *button_gb_translate_toggle = gtk_button_new_with_label(_(_L("剪貼區 簡體字->正體字")));
  gtk_box_pack_start (GTK_BOX (vbox), button_gb_translate_toggle, TRUE, TRUE, 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(_(_L("剪貼區 注音查詢")));
  gtk_box_pack_start (GTK_BOX (vbox), button_juying_learn_toggle, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_juying_learn_toggle), "clicked",
                    G_CALLBACK (cb_juying_learn), NULL);

  GtkWidget *expander_ts = gtk_expander_new (_(_L("詞庫選項")));
  gtk_box_pack_start (GTK_BOX (vbox), expander_ts, FALSE, FALSE, 0);
  g_signal_connect (expander_ts, "notify::expanded",
                  G_CALLBACK (expander_callback), NULL);

  GtkWidget *vbox_ts = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (expander_ts), vbox_ts);


  GtkWidget *button_ts_export = gtk_button_new_with_label(_(_L("詞庫匯出")));
  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(_(_L("詞庫匯入")));
  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(_(_L("詞庫編輯")));
  gtk_widget_set_hexpand (button_ts_edit, TRUE);
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_edit, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_ts_edit), "clicked",
                    G_CALLBACK (cb_ts_edit), NULL);

  if (inmd[default_input_method].method_type == method_type_TSIN) {
  GtkWidget *button_tslearn = gtk_button_new_with_label(_(_L("讓詞音從文章學習詞")));
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_tslearn, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_tslearn), "clicked",
                    G_CALLBACK (cb_tslearn), NULL);

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

  GtkWidget *button_ts_contribute = gtk_button_new_with_label(_(_L("貢獻選擇的詞庫")));
  gtk_box_pack_start (GTK_BOX (vbox_ts), button_ts_contribute, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_ts_contribute), "clicked",
                    G_CALLBACK (cb_ts_contribute), NULL);
  }


  GtkWidget *button_about = gtk_button_new_with_label(_(_L("關於 gcin")));
  gtk_box_pack_start (GTK_BOX (vbox), button_about, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_about), "clicked",
                    G_CALLBACK (create_about_window),  NULL);


  GtkWidget *button_help = gtk_button_new_from_stock (GTK_STOCK_HELP);
  gtk_box_pack_start (GTK_BOX (vbox), button_help, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_help), "clicked",
                    G_CALLBACK (cb_help), NULL);


  GtkWidget *button_quit = gtk_button_new_from_stock (GTK_STOCK_QUIT);
  gtk_box_pack_start (GTK_BOX (vbox), button_quit, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (button_quit), "clicked",
                    G_CALLBACK (close_application), NULL);

  gtk_widget_show_all(main_window);
}
Пример #30
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);
  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 (cb_default_input_method), NULL);

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

  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 (cb_gtab_conf), NULL);

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


  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 TRAY_ENABLED
  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 TRAY_ENABLED
  }
#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);

  GtkWidget *expander_ts = gtk_expander_new (_("詞庫選項"));
  gtk_box_pack_start (GTK_BOX (vbox), expander_ts, FALSE, FALSE, 0);

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


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

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

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

  gtk_widget_show_all(main_window);
}