Ejemplo n.º 1
0
XeTeXDialog::XeTeXDialog(int dummy)
{
  extern Settings *settings;
  ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());

  gtkbuilder = gtk_builder_new ();
  gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.xetexdialog.xml").c_str(), NULL);

  dialog = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "dialog"));

  label_portion = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_portion"));

  button_portion = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_portion"));
  g_signal_connect((gpointer) button_portion, "clicked", G_CALLBACK(on_button_portion_clicked), gpointer(this));

  expander = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "expander"));
  gtk_expander_set_expanded(GTK_EXPANDER(expander), settings->session.print_dialog_options_expanded);

  label_expander = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_expander"));

  notebook = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "notebook"));
  g_signal_connect_after((gpointer) notebook, "switch_page", G_CALLBACK(on_notebook_switch_page), gpointer(this));

  label_tab_notes = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_notes"));
  checkbutton_full_references = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_full_references"));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_full_references), settings->session.print_references_in_notes_in_full);
  // Set widget insensitive since is has not yet been implemented.
  gtk_widget_set_sensitive (checkbutton_full_references, false);

  label_tab_page = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_page"));
  checkbutton_cropmarks = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_cropmarks"));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_cropmarks), settings->session.print_crop_marks);

  label_tab_mapping = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_mapping"));
  button_font_mapping_clear = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_font_mapping_clear"));
  filechooserbutton_font_mapping_file = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "filechooserbutton_font_mapping_file"));
  g_signal_connect((gpointer) button_font_mapping_clear, "clicked", G_CALLBACK(on_button_font_mapping_clear_clicked), gpointer(filechooserbutton_font_mapping_file));
  if (!projectconfig->xetex_font_mapping_file_get().empty()) {
    gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooserbutton_font_mapping_file), projectconfig->xetex_font_mapping_file_get().c_str());
  }

  label_tab_engine = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_engine"));
  GSList *shaping_engine_group = NULL;
  radiobutton_shaping_engine_generic = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_generic"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic), shaping_engine_group);
  shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic));
  radiobutton_shaping_engine_arab = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_arab"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab), shaping_engine_group);
  shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab));
  shaping_engine_set (projectconfig->xetex_shaping_engine_get());

  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, NULL, "file/print/project");
  cancelbutton = indialoghelp->cancelbutton;
  okbutton = indialoghelp->okbutton;
  gtk_widget_grab_focus(okbutton);
  gtk_widget_grab_default(okbutton);
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  set_gui();
}
Ejemplo n.º 2
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkRadioButton_gtk_1radio_1button_1set_1group
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jlongArray _group
)
{
	GtkRadioButton* self;
	GSList* group;

	// convert parameter self
	self = (GtkRadioButton*) _self;

	// convert parameter group
	group = (GSList*) bindings_java_convert_jarray_to_gslist(env, _group);
	if (group == NULL) {
		return; // Java Exception already thrown
	}

	// call function
	gtk_radio_button_set_group(self, group);

	// cleanup parameter self

	// cleanup parameter group
	g_slist_free(group);
}
Ejemplo n.º 3
0
 foreach(item, group, n) {
   if(n == 0) continue;
   GSList *currentGroup = gtk_radio_button_get_group(GTK_RADIO_BUTTON(group[0].p.gtkWidget));
   if(currentGroup != gtk_radio_button_get_group(GTK_RADIO_BUTTON(gtkWidget))) {
     gtk_radio_button_set_group(GTK_RADIO_BUTTON(gtkWidget), currentGroup);
   }
 }
Ejemplo n.º 4
0
/**
 * gtk_radio_tool_button_set_group:
 * @button: a #GtkRadioToolButton
 * @group: (element-type GtkRadioButton) (allow-none): an existing radio button group, or %NULL
 * 
 * Adds @button to @group, removing it from the group it belonged to before.
 * 
 * Since: 2.4
 **/
void
gtk_radio_tool_button_set_group (GtkRadioToolButton *button,
				 GSList             *group)
{
  g_return_if_fail (GTK_IS_RADIO_TOOL_BUTTON (button));

  gtk_radio_button_set_group (get_radio_button (button), group);
}
Ejemplo n.º 5
0
void cgraphics_radiobutton_set_group( widget_t *rr )
{
    radiobutton_widget_t *radio = (radiobutton_widget_t *)rr;

    /* first, set the group to the list we have */
    gtk_radio_button_set_group( radio->widget.native, radio->group->ndata );

    /* then get it back so we have the new head pointer (incase it changed, like on first item) */
    radio->group->ndata = gtk_radio_button_get_group( radio->widget.native );
}
JNIEXPORT void JNICALL 
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
  (JNIEnv *env, jobject obj, jobject group)
{
  GtkRadioButton *button;
  void *native_group, *ptr;

  ptr = NSA_GET_PTR (env, obj);

  gdk_threads_enter ();

  /* FIXME: we can't yet switch between a checkbutton and a
     radiobutton.  However, AWT requires this.  For now we just
     crash.  */

  button = GTK_RADIO_BUTTON (ptr);

  native_group = NSA_GET_PTR (env, group);
  if (native_group == NULL)
    gtk_radio_button_set_group (button, NULL);
  else
    gtk_radio_button_set_group (button,
				gtk_radio_button_group 
				(GTK_RADIO_BUTTON (native_group)));

  gdk_threads_leave ();

  /* If the native group wasn't set on the new CheckboxGroup, then set
     it now so that the right thing will happen with the next
     radiobutton.  The native state for a CheckboxGroup is a pointer
     to one of the widgets in the group.  We are careful to keep this
     always pointing at a live widget; whenever a widget is destroyed
     (or otherwise removed from the group), the CheckboxGroup peer is
     notified.  */
  if (native_group == NULL)
    NSA_SET_PTR (env, group, native_group);
}
Ejemplo n.º 7
0
void pRadioLabel::setGroup(const group<RadioLabel>& group) {
  if(&parent() == this) return;
  parent().locked = true;
  gtk_radio_button_set_group(
    GTK_RADIO_BUTTON(gtkWidget),
    gtk_radio_button_get_group(GTK_RADIO_BUTTON(parent().gtkWidget))
  );
  for(auto& item : radioLabel.state.group) {
    if(item.state.checked) {
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item.p.gtkWidget), true);
      break;
    }
  }
  parent().locked = false;
}
Ejemplo n.º 8
0
int
clip_GTK_RADIOBUTTONSETGROUP(ClipMachine * cm)
{
	C_widget *cbtn = _fetch_cw_arg(cm);
	C_widget *cgrp = _fetch_cwidget(cm,_clip_spar(cm,2));
        GSList * group = NULL;
	CHECKARG2(2,MAP_t,NUMERIC_t);
        CHECKCWID(cbtn,GTK_IS_RADIO_BUTTON);
        if (cgrp && cgrp->type != GTK_WIDGET_RADIO_GROUP) goto err;
	if (cgrp && cgrp->data)
		group = gtk_radio_button_get_group(
			GTK_RADIO_BUTTON(((GSList*)(cgrp->data))->data));
	gtk_radio_button_set_group(GTK_RADIO_BUTTON(cbtn->widget),group);
	if (cgrp && cgrp->data)
		cgrp->data = gtk_radio_button_get_group(GTK_RADIO_BUTTON(cbtn->widget));
        return 0;
err:
	return 1;
}
Ejemplo n.º 9
0
BackupAssistant::BackupAssistant(int dummy) :
  AssistantBase(_("Backup"), _("backup"))
// Backup assistant.
{
  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);
  
  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("A backup helps keep your data safe"));

  // Configuration and initialization.
  extern Settings *settings;
  ustring project = settings->genconfig.project_get();

  // Build the GUI for the task selector.
  vbox_select_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_select_type);
  page_number_select_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_select_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_select_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_select_type, _("What would you like to backup?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_select_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_select_type, true);

  GSList *radiobutton_select_type_group = NULL;

  radiobutton_select_type_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Bible"));
  gtk_widget_show (radiobutton_select_type_bible);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible));

  radiobutton_select_type_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Notes"));
  gtk_widget_show (radiobutton_select_type_notes);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes));

  radiobutton_select_type_resource = gtk_radio_button_new_with_mnemonic (NULL, _("Resource"));
  gtk_widget_show (radiobutton_select_type_resource);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_resource, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource));

  radiobutton_select_type_everything = gtk_radio_button_new_with_mnemonic (NULL, _("Everything"));
  gtk_widget_show (radiobutton_select_type_everything);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_everything, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything));

  Shortcuts shortcuts_select_type (0);
  shortcuts_select_type.button (radiobutton_select_type_bible);
  shortcuts_select_type.button (radiobutton_select_type_notes);
  shortcuts_select_type.button (radiobutton_select_type_resource);
  shortcuts_select_type.button (radiobutton_select_type_everything);
  shortcuts_select_type.consider_assistant();
  shortcuts_select_type.process();

  // Confirm or change Bible.
  vbox_bible_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_bible_name);
  page_number_bible_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_name, _("Is this the right Bible?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, true);

  label_bible_name = gtk_label_new (_("Bible name"));
  gtk_widget_show (label_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), label_bible_name, FALSE, FALSE, 0);

  button_bible_name = gtk_button_new ();
  gtk_widget_show (button_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), button_bible_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_bible_name, "clicked", G_CALLBACK (on_button_bible_name_clicked), gpointer (this));

  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label1;

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_bible_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock (_("gtk-open"), GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  Shortcuts shortcuts_bible_name (0);
  shortcuts_bible_name.label (label1);
  shortcuts_bible_name.consider_assistant();
  shortcuts_bible_name.process();

  // Confirm or change Resource.
  vbox_resource_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_resource_name);
  page_number_resource_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_resource_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_resource_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_resource_name, _("Is this the right Resource?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_resource_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_resource_name, true);

  label_resource_name = gtk_label_new (_("Resource name"));
  gtk_widget_show (label_resource_name);
  gtk_box_pack_start (GTK_BOX (vbox_resource_name), label_resource_name, FALSE, FALSE, 0);

  button_resource_name = gtk_button_new ();
  gtk_widget_show (button_resource_name);
  gtk_box_pack_start (GTK_BOX (vbox_resource_name), button_resource_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_resource_name, "clicked", G_CALLBACK (on_button_resource_name_clicked), gpointer (this));

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_resource_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  Shortcuts shortcuts_resource_name (0);
  shortcuts_resource_name.label (label1);
  shortcuts_resource_name.consider_assistant();
  shortcuts_resource_name.process();

  // Select file where to save to.
  vbox_file = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_file);
  page_number_file = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_file);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_file), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_file, _("Where would you like to save it?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_file, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_file, false);

  button_file = gtk_button_new ();
  gtk_widget_show (button_file);
  gtk_box_pack_start (GTK_BOX (vbox_file), button_file, FALSE, FALSE, 0);

  GtkWidget *alignment2;
  GtkWidget *hbox2;
  GtkWidget *image2;

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

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

  image2 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox2), image2, FALSE, FALSE, 0);

  label_file = gtk_label_new_with_mnemonic ("");
  gtk_widget_show (label_file);
  gtk_box_pack_start (GTK_BOX (hbox2), label_file, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_file, "clicked", G_CALLBACK (on_button_file_clicked), gpointer(this));

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Backup is about to be made"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("Backup is about to be made"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new ("");
  gtk_widget_show (label_progress);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new (_("Backup is done"));
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("The backup was completed successfully."));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}
void konepuremilitary_single_cpi_selector_set_group(KonepuremilitarySingleCpiSelector *selector, GSList *group) {
	gtk_radio_button_set_group(selector->priv->radio, group);
}
Ejemplo n.º 11
0
GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent)
{
	GError* error = NULL;
	gladeFile = gtk_builder_new();
	if (!gtk_builder_add_from_file(gladeFile, glade_file_location->options, &error)) {
		g_warning("Couldn't load builder file: %s", error->message);
		g_error_free(error);
		return NULL;
	}
	
	current_browser = bw;
	wndPreferences = GTK_DIALOG(gtk_builder_get_object(gladeFile, "dlgPreferences"));
	gtk_window_set_transient_for(GTK_WINDOW(wndPreferences), parent);
	
	FIND_WIDGET(sourceButtonTab);
	FIND_WIDGET(sourceButtonWindow);
	GSList *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(
			sourceButtonWindow));
	gtk_radio_button_set_group(GTK_RADIO_BUTTON(sourceButtonTab), group);
	
	/* set the widgets to reflect the current options */
	nsgtk_options_load();
	
	/* Connect all widgets to their appropriate callbacks */
	CONNECT(entryHomePageURL, "focus-out-event");
	CONNECT(setCurrentPage, "clicked");
	CONNECT(setDefaultPage, "clicked");
	CONNECT(checkHideAdverts, "toggled");

	CONNECT(checkDisablePopups, "toggled");
	CONNECT(checkDisablePlugins, "toggled");
	CONNECT(spinHistoryAge, "focus-out-event");
	CONNECT(checkHoverURLs, "toggled");
	
	CONNECT(comboLanguage, "changed");
	
	CONNECT(checkDisplayRecentURLs, "toggled");
	CONNECT(checkSendReferer, "toggled");
	CONNECT(checkShowSingleTab, "toggled");

	CONNECT(comboProxyType, "changed");
	CONNECT(entryProxyHost, "focus-out-event");
	CONNECT(entryProxyPort, "focus-out-event");
	CONNECT(entryProxyUser, "focus-out-event");
	CONNECT(entryProxyPassword, "focus-out-event");
	CONNECT(spinMaxFetchers, "value-changed");
	CONNECT(spinFetchesPerHost, "value-changed");
	CONNECT(spinCachedConnections, "value-changed");

	CONNECT(checkResampleImages, "toggled");
	CONNECT(spinAnimationSpeed, "value-changed");
	CONNECT(checkDisableAnimations, "toggled");

	CONNECT(fontSansSerif, "font-set");
	CONNECT(fontSerif, "font-set");
	CONNECT(fontMonospace, "font-set");
	CONNECT(fontCursive, "font-set");
	CONNECT(fontFantasy, "font-set");
	CONNECT(comboDefault, "changed");
	CONNECT(spinDefaultSize, "value-changed");
	CONNECT(spinMinimumSize, "value-changed");
	CONNECT(fontPreview, "clicked");
	
	CONNECT(comboButtonType, "changed");

	CONNECT(comboTabPosition, "changed");

	CONNECT(spinMemoryCacheSize, "value-changed");
	CONNECT(spinDiscCacheAge, "value-changed");
	
	CONNECT(checkClearDownloads, "toggled");
	CONNECT(checkRequestOverwrite, "toggled");
	CONNECT(fileChooserDownloads, "current-folder-changed");
	
	CONNECT(checkFocusNew, "toggled");
	CONNECT(checkNewBlank, "toggled");
	CONNECT(checkUrlSearch, "toggled");
	CONNECT(comboSearch, "changed");
	
	CONNECT(combotheme, "changed");
	CONNECT(buttonaddtheme, "clicked");
	CONNECT(sourceButtonTab, "toggled");
	
	CONNECT(spinMarginTop, "value-changed");
	CONNECT(spinMarginBottom, "value-changed");
	CONNECT(spinMarginLeft, "value-changed");
	CONNECT(spinMarginRight, "value-changed");
	CONNECT(spinExportScale, "value-changed");
	CONNECT(checkSuppressImages, "toggled");
	CONNECT(checkRemoveBackgrounds, "toggled");
	CONNECT(checkFitPage, "toggled");
	CONNECT(checkCompressPDF, "toggled");
	CONNECT(checkPasswordPDF, "toggled");
	CONNECT(setDefaultExportOptions, "clicked");
		
	g_signal_connect(G_OBJECT(wndPreferences), "response",
		G_CALLBACK (dialog_response_handler), NULL);
	
	g_signal_connect(G_OBJECT(wndPreferences), "delete-event",
		G_CALLBACK (on_dialog_close), (gpointer)TRUE);
	
	g_signal_connect(G_OBJECT(wndPreferences), "destroy",
		G_CALLBACK (on_dialog_close), (gpointer)FALSE);
				
	gtk_widget_show(GTK_WIDGET(wndPreferences));
	
	return wndPreferences;
}
Ejemplo n.º 12
0
void
create_main_window (ContactsData *data)
{
	GtkWidget *main_window;
	GtkWidget *vbox7;
	GtkWidget *main_menubar;
	GtkWidget *contacts_menu;
	GtkWidget *contacts_menu_menu;
	GtkWidget *new_menuitem;
	GtkWidget *edit_menuitem;
	GtkWidget *delete_menuitem;
	GtkWidget *contacts_import;
	GtkWidget *contacts_quit;
	GtkWidget *contact_menu;
	GtkWidget *contact_menu_menu;
	GtkWidget *contact_delete;
	GtkWidget *edit_groups;
	GtkWidget *contact_export;
	GtkWidget *contact_quit;
	GtkWidget *edit_menu;
	GtkWidget *menuitem5_menu;
	GtkWidget *cut;
	GtkWidget *copy;
	GtkWidget *paste;
	GtkWidget *help_menu;
	GtkWidget *menuitem7_menu;
	GtkWidget *about1;
	GtkWidget *main_notebook;
	GtkWidget *main_hpane;
	GtkWidget *contacts_vbox;
	GtkWidget *scrolledwindow2;
	GtkWidget *contacts_treeview;
	GtkWidget *search_hbox;
	GtkWidget *search_entry_hbox;
	GtkWidget *search_entry;
	GtkWidget *search_tab_hbox;
	GtkWidget *symbols_radiobutton;
	GSList *symbols_radiobutton_group = NULL;
	GtkWidget *atog_radiobutton;
	GtkWidget *hton_radiobutton;
	GtkWidget *otou_radiobutton;
	GtkWidget *vtoz_radiobutton;
	GtkWidget *vbox3;
	GtkWidget *summary_vbox;
	GtkWidget *preview_header_hbox;
	GtkWidget *preview_namegroup_vbox;
	GtkWidget *summary_name_label;
	GtkWidget *summary_group_label;
	GtkWidget *photo_image;
	GtkWidget *scrolledwindow3;
	GtkWidget *viewport1;
	GtkWidget *summary_table;
	GtkWidget *summary_hbuttonbox;
	GtkWidget *new_button;
	GtkWidget *edit_button;
	GtkWidget *delete_button;
	GtkWidget *vbox4;
	GtkWidget *scrolledwindow4;
	GtkWidget *viewport2;
	GtkWidget *edit_table;
	GtkWidget *hbuttonbox2;
	GtkWidget *add_field_button;
	GtkWidget *remove_field_button;
	GtkWidget *edit_done_button;
	GtkWidget *widget;
	GtkAccelGroup *accel_group;
	ContactsUI *ui = data->ui;
	GtkSizeGroup *size_group;

#ifdef HAVE_GCONF
	GConfClient *client;
	gchar *search;
	gint width, height;
#endif

	accel_group = gtk_accel_group_new ();

	main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (main_window), _("Contacts"));
	gtk_window_set_icon_name (GTK_WINDOW (main_window), "contacts");
	gtk_window_set_default_size (GTK_WINDOW (main_window), 320, 240);

	vbox7 = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (main_window), vbox7);

	main_menubar = gtk_menu_bar_new ();
	gtk_box_pack_start (GTK_BOX (vbox7), main_menubar, FALSE, FALSE, 0);

	contacts_menu = gtk_menu_item_new_with_mnemonic (_("C_ontacts"));
	gtk_container_add (GTK_CONTAINER (main_menubar), contacts_menu);

	contacts_menu_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (contacts_menu), contacts_menu_menu);

	new_menuitem = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), new_menuitem);

	edit_menuitem = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), edit_menuitem);
	gtk_widget_set_sensitive (edit_menuitem, FALSE);

	delete_menuitem = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), delete_menuitem);
	gtk_widget_set_sensitive (delete_menuitem, FALSE);

	contacts_import = gtk_menu_item_new_with_mnemonic (_("_Import..."));
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), contacts_import);

	widget = gtk_separator_menu_item_new ();
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), widget);
	gtk_widget_set_sensitive (widget, FALSE);

	contacts_quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
	gtk_container_add (GTK_CONTAINER (contacts_menu_menu), contacts_quit);

	contact_menu = gtk_menu_item_new_with_mnemonic (_("C_ontact"));
	gtk_container_add (GTK_CONTAINER (main_menubar), contact_menu);
	g_object_set (G_OBJECT (contact_menu), "no-show-all", TRUE, NULL);

	contact_menu_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (contact_menu), contact_menu_menu);

	contact_delete = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
	gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_delete);

	edit_groups = gtk_menu_item_new_with_mnemonic (_("_Groups"));
	gtk_container_add (GTK_CONTAINER (contact_menu_menu), edit_groups);

	contact_export = gtk_menu_item_new_with_mnemonic (_("_Export"));
	gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_export);

	widget = gtk_separator_menu_item_new ();
	gtk_container_add (GTK_CONTAINER (contact_menu_menu), widget);
	gtk_widget_set_sensitive (widget, FALSE);

	contact_quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
	gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_quit);

	edit_menu = gtk_menu_item_new_with_mnemonic (_("Ed_it"));
	gtk_container_add (GTK_CONTAINER (main_menubar), edit_menu);

	menuitem5_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit_menu), menuitem5_menu);

	cut = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
	gtk_container_add (GTK_CONTAINER (menuitem5_menu), cut);

	copy = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
	gtk_container_add (GTK_CONTAINER (menuitem5_menu), copy);

	paste = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
	gtk_container_add (GTK_CONTAINER (menuitem5_menu), paste);

	help_menu = gtk_menu_item_new_with_mnemonic (_("_Help"));
	gtk_container_add (GTK_CONTAINER (main_menubar), help_menu);

	menuitem7_menu = gtk_menu_new ();
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (help_menu), menuitem7_menu);

	about1 = gtk_image_menu_item_new_from_stock ("gtk-about", accel_group);
	gtk_container_add (GTK_CONTAINER (menuitem7_menu), about1);

	main_notebook = gtk_notebook_new ();
	gtk_box_pack_start (GTK_BOX (vbox7), main_notebook, TRUE, TRUE, 0);
	GTK_WIDGET_UNSET_FLAGS (main_notebook, GTK_CAN_FOCUS);
	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (main_notebook), FALSE);
	gtk_notebook_set_show_border (GTK_NOTEBOOK (main_notebook), FALSE);

	main_hpane = gtk_hpaned_new ();
	gtk_container_add (GTK_CONTAINER (main_notebook), main_hpane);

	contacts_vbox = gtk_vbox_new (FALSE, 6);
	gtk_paned_pack1 (GTK_PANED (main_hpane), contacts_vbox, FALSE, FALSE);
	gtk_container_set_border_width (GTK_CONTAINER (contacts_vbox), 6);

	groups_combobox = gtk_combo_box_new ();
	GtkListStore *ls = gtk_list_store_new (1, G_TYPE_STRING);
	GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
	g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (groups_combobox),
	    groups_combo_seperator_func, NULL, NULL);
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (groups_combobox), renderer, TRUE);
	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (groups_combobox), renderer, "text", 0);
	gtk_combo_box_set_model (GTK_COMBO_BOX (groups_combobox), GTK_TREE_MODEL(ls));
	gtk_box_pack_start (GTK_BOX (contacts_vbox), groups_combobox, FALSE, TRUE, 0);
	gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (groups_combobox), FALSE);

	scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
	gtk_box_pack_start (GTK_BOX (contacts_vbox), scrolledwindow2, TRUE, TRUE, 0);
	GTK_WIDGET_UNSET_FLAGS (scrolledwindow2, GTK_CAN_FOCUS);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN);

	contacts_treeview = gtk_tree_view_new ();
	gtk_container_add (GTK_CONTAINER (scrolledwindow2), contacts_treeview);
	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (contacts_treeview), FALSE);
	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (contacts_treeview), FALSE);

	search_hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_end (GTK_BOX (contacts_vbox), search_hbox, FALSE, TRUE, 0);

	search_entry_hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (search_hbox), search_entry_hbox, TRUE, TRUE, 0);

	search_entry = gtk_entry_new ();
	gtk_box_pack_end (GTK_BOX (search_entry_hbox), search_entry, TRUE, TRUE, 0);
	gtk_entry_set_activates_default (GTK_ENTRY (search_entry), TRUE);

	widget = gtk_label_new_with_mnemonic (_("_Search:"));
	gtk_box_pack_start (GTK_BOX (search_entry_hbox), widget, FALSE, FALSE, 0);
	gtk_misc_set_padding (GTK_MISC (widget), 6, 0);
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), search_entry);

	search_tab_hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (search_hbox), search_tab_hbox, TRUE, TRUE, 0);
	g_object_set (G_OBJECT (search_tab_hbox), "no-show-all", TRUE, NULL);

	symbols_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("0-9#"));
	gtk_box_pack_start (GTK_BOX (search_tab_hbox), symbols_radiobutton, TRUE, FALSE, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (symbols_radiobutton), symbols_radiobutton_group);
	symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (symbols_radiobutton));

	atog_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("A-G"));
	gtk_box_pack_start (GTK_BOX (search_tab_hbox), atog_radiobutton, TRUE, FALSE, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (atog_radiobutton), symbols_radiobutton_group);
	symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (atog_radiobutton));
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (atog_radiobutton), TRUE);

	hton_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("H-N"));
	gtk_box_pack_start (GTK_BOX (search_tab_hbox), hton_radiobutton, TRUE, FALSE, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (hton_radiobutton), symbols_radiobutton_group);
	symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (hton_radiobutton));

	otou_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("O-U"));
	gtk_box_pack_start (GTK_BOX (search_tab_hbox), otou_radiobutton, TRUE, FALSE, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (otou_radiobutton), symbols_radiobutton_group);
	symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (otou_radiobutton));

	vtoz_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("V-Z"));
	gtk_box_pack_start (GTK_BOX (search_tab_hbox), vtoz_radiobutton, TRUE, FALSE, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (vtoz_radiobutton), symbols_radiobutton_group);
	symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (vtoz_radiobutton));

	vbox3 = gtk_vbox_new (FALSE, 6);
	gtk_paned_pack2 (GTK_PANED (main_hpane), vbox3, TRUE, FALSE);
	gtk_container_set_border_width (GTK_CONTAINER (vbox3), 6);

	summary_vbox = gtk_vbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (vbox3), summary_vbox, TRUE, TRUE, 0);

	preview_header_hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (summary_vbox), preview_header_hbox, FALSE, TRUE, 0);

	preview_namegroup_vbox = gtk_vbox_new (FALSE, 0);

	summary_name_label = gtk_label_new (NULL);
	gtk_box_pack_start (GTK_BOX (preview_namegroup_vbox), summary_name_label, TRUE, TRUE, 0);
	GTK_WIDGET_SET_FLAGS (summary_name_label, GTK_CAN_FOCUS);
	gtk_label_set_use_markup (GTK_LABEL (summary_name_label), TRUE);
	gtk_label_set_selectable (GTK_LABEL (summary_name_label), TRUE);
	gtk_misc_set_alignment (GTK_MISC (summary_name_label), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (summary_name_label), 6, 0);
	gtk_label_set_ellipsize (GTK_LABEL (summary_name_label), PANGO_ELLIPSIZE_END);

	summary_group_label = gtk_label_new (NULL);
	gtk_box_pack_start (GTK_BOX (preview_namegroup_vbox), summary_group_label, TRUE, TRUE, 0);
	GTK_WIDGET_SET_FLAGS (summary_group_label, GTK_CAN_FOCUS);
	gtk_label_set_use_markup (GTK_LABEL (summary_group_label), TRUE);
	gtk_label_set_selectable (GTK_LABEL (summary_group_label), TRUE);
	gtk_misc_set_alignment (GTK_MISC (summary_group_label), 0, 0.5);
	gtk_misc_set_padding (GTK_MISC (summary_group_label), 6, 0);
	gtk_label_set_ellipsize (GTK_LABEL (summary_group_label), PANGO_ELLIPSIZE_END);

	gtk_box_pack_start (GTK_BOX (preview_header_hbox), preview_namegroup_vbox, TRUE, TRUE, 0);


	/* load stock_person as the default icon so the image has the correct
	 * size before a contact is loaded */
	photo_image = gtk_image_new_from_icon_name ("stock_person", GTK_ICON_SIZE_DIALOG);
	gtk_box_pack_end (GTK_BOX (preview_header_hbox), photo_image, FALSE, TRUE, 6);
	gtk_misc_set_padding (GTK_MISC (photo_image), 1, 0);

	scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
	gtk_box_pack_start (GTK_BOX (summary_vbox), scrolledwindow3, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	viewport1 = gtk_viewport_new (NULL, NULL);
	gtk_container_add (GTK_CONTAINER (scrolledwindow3), viewport1);

	summary_table = gtk_table_new (1, 2, FALSE);
	gtk_container_add (GTK_CONTAINER (viewport1), summary_table);
	gtk_table_set_row_spacings (GTK_TABLE (summary_table), 6);
	gtk_table_set_col_spacings (GTK_TABLE (summary_table), 6);

	summary_hbuttonbox = gtk_hbutton_box_new ();
	gtk_box_pack_end (GTK_BOX (vbox3), summary_hbuttonbox, FALSE, FALSE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (summary_hbuttonbox), GTK_BUTTONBOX_END);
	gtk_box_set_spacing (GTK_BOX (summary_hbuttonbox), 6);

	new_button = gtk_button_new_from_stock ("gtk-new");
	gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), new_button);
	GTK_WIDGET_SET_FLAGS (new_button, GTK_CAN_DEFAULT);

	edit_button = gtk_button_new_from_stock ("gtk-edit");
	gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), edit_button);
	gtk_widget_set_sensitive (edit_button, FALSE);
	GTK_WIDGET_SET_FLAGS (edit_button, GTK_CAN_DEFAULT);

	delete_button = gtk_button_new_from_stock ("gtk-delete");
	gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), delete_button);
	gtk_widget_set_sensitive (delete_button, FALSE);
	GTK_WIDGET_SET_FLAGS (delete_button, GTK_CAN_DEFAULT);
	gtk_button_set_focus_on_click (GTK_BUTTON (delete_button), FALSE);

	vbox4 = gtk_vbox_new (FALSE, 6);
	gtk_container_add (GTK_CONTAINER (main_notebook), vbox4);
	gtk_container_set_border_width (GTK_CONTAINER (vbox4), 6);

	scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
	gtk_box_pack_start (GTK_BOX (vbox4), scrolledwindow4, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	viewport2 = gtk_viewport_new (NULL, NULL);
	gtk_container_add (GTK_CONTAINER (scrolledwindow4), viewport2);

	edit_table = gtk_table_new (1, 2, FALSE);
	gtk_container_add (GTK_CONTAINER (viewport2), edit_table);
	gtk_container_set_border_width (GTK_CONTAINER (edit_table), 6);
	gtk_table_set_row_spacings (GTK_TABLE (edit_table), 6);

	hbuttonbox2 = gtk_hbutton_box_new ();
	gtk_box_pack_start (GTK_BOX (vbox4), hbuttonbox2, FALSE, TRUE, 0);
	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END);
	gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 6);

	add_field_button = gtk_button_new_with_mnemonic (_("_Add Field"));
	gtk_container_add (GTK_CONTAINER (hbuttonbox2), add_field_button);
	GTK_WIDGET_SET_FLAGS (add_field_button, GTK_CAN_DEFAULT);

	remove_field_button = gtk_button_new_with_mnemonic (_("_Remove Field"));
	gtk_container_add (GTK_CONTAINER (hbuttonbox2), remove_field_button);
	GTK_WIDGET_SET_FLAGS (remove_field_button, GTK_CAN_DEFAULT);
	gtk_button_set_focus_on_click (GTK_BUTTON (remove_field_button), FALSE);

	edit_done_button = gtk_button_new_from_stock ("gtk-close");
	gtk_container_add (GTK_CONTAINER (hbuttonbox2), edit_done_button);
	GTK_WIDGET_SET_FLAGS (edit_done_button, GTK_CAN_DEFAULT);


	gtk_widget_grab_focus (contacts_treeview);
	gtk_widget_grab_default (edit_button);
	gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group);

	/* Set up size group for bottom row of buttons and search */
	size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
	gtk_size_group_add_widget (size_group, search_hbox);
	gtk_size_group_add_widget (size_group, summary_hbuttonbox);
	g_object_unref (size_group);



	/* connect signals */
	g_signal_connect (G_OBJECT (main_window), "delete-event",
			G_CALLBACK (contacts_main_window_delete_event_cb), data);

	g_signal_connect ((gpointer) main_window, "destroy",
			G_CALLBACK (gtk_main_quit),
			NULL);
	g_signal_connect_swapped ((gpointer) main_window, "set_focus",
			G_CALLBACK (contacts_edit_set_focus_cb),
			GTK_OBJECT (remove_field_button));
	g_signal_connect ((gpointer) contacts_quit, "activate",
			G_CALLBACK (gtk_main_quit),
			NULL);
	g_signal_connect ((gpointer) contact_quit, "activate",
			G_CALLBACK (gtk_main_quit),
			NULL);
	g_signal_connect_swapped ((gpointer) cut, "activate",
			G_CALLBACK (contacts_cut_cb),
			GTK_OBJECT (main_window));
	g_signal_connect_swapped ((gpointer) copy, "activate",
			G_CALLBACK (contacts_copy_cb),
			GTK_OBJECT (main_window));
	g_signal_connect_swapped ((gpointer) paste, "activate",
			G_CALLBACK (contacts_paste_cb),
			GTK_OBJECT (main_window));
	g_signal_connect_swapped ((gpointer) about1, "activate",
			G_CALLBACK (contacts_about_cb),
			main_window);
	g_signal_connect_swapped ((gpointer) groups_combobox, "changed",
			G_CALLBACK (contacts_update_treeview),
			data);
	g_signal_connect_data ((gpointer) contacts_treeview, "key_press_event",
			G_CALLBACK (contacts_treeview_search_cb),
			GTK_OBJECT (search_entry),
			NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
	g_signal_connect ((gpointer) search_entry, "changed",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) symbols_radiobutton, "clicked",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) atog_radiobutton, "clicked",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) hton_radiobutton, "clicked",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) otou_radiobutton, "clicked",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) vtoz_radiobutton, "clicked",
			G_CALLBACK (contacts_search_changed_cb),
			data);
	g_signal_connect ((gpointer) remove_field_button, "clicked",
			G_CALLBACK (contacts_remove_field_cb),
			NULL);
	g_signal_connect (G_OBJECT (new_button), "clicked",
			  G_CALLBACK (contacts_new_cb), data);
	g_signal_connect (G_OBJECT (new_menuitem), "activate",
			  G_CALLBACK (contacts_new_cb), data);
	g_signal_connect (G_OBJECT (edit_button), "clicked",
			  G_CALLBACK (contacts_edit_cb), data);
	g_signal_connect (G_OBJECT (contacts_treeview), "row_activated",
			  G_CALLBACK (contacts_treeview_edit_cb), data);
	g_signal_connect (G_OBJECT (edit_menuitem), "activate",
			  G_CALLBACK (contacts_edit_cb), data);
	g_signal_connect (G_OBJECT (delete_button), "clicked",
			  G_CALLBACK (contacts_delete_cb), data);
	g_signal_connect (G_OBJECT (delete_menuitem), "activate",
			  G_CALLBACK (contacts_delete_cb), data);
	g_signal_connect (G_OBJECT (contacts_import), "activate",
			  G_CALLBACK (contacts_import_cb), data);
	g_signal_connect (G_OBJECT (edit_menu), "activate",
			  G_CALLBACK (contacts_edit_menu_activate_cb), data);
	g_signal_connect (G_OBJECT (groups_combobox), "changed",
			  G_CALLBACK (groups_combobox_changed_cb), data);

	ui->contact_delete = contact_delete;
	ui->contact_export = contact_export;
	ui->contact_menu = contact_menu;

	ui->contacts_import = contacts_import;
	ui->contacts_menu = contacts_menu;
	ui->contacts_treeview = contacts_treeview;

	ui->new_menuitem = new_menuitem;
	ui->copy_menuitem = copy;
	ui->cut_menuitem = cut;
	ui->delete_menuitem = delete_menuitem;
	ui->delete_button = delete_button;
	ui->edit_menuitem = edit_menuitem;
	ui->edit_button = edit_button;
	ui->edit_done_button = edit_done_button;
	ui->edit_groups = edit_groups;
	ui->edit_menu = edit_menu;
	ui->edit_table = edit_table;
	ui->main_menubar = main_menubar;
	ui->main_notebook = main_notebook;
	ui->main_window = main_window;
	ui->new_button = new_button;
	ui->paste_menuitem = paste;
	ui->photo_image = photo_image;
	ui->preview_header_hbox = preview_header_hbox;

	ui->add_field_button = add_field_button;
	ui->remove_field_button = remove_field_button;

	ui->search_entry = search_entry;
	ui->search_entry_hbox = search_entry_hbox;
	ui->search_hbox = search_hbox;
	ui->search_tab_hbox = search_tab_hbox;
	//ui->groups_combobox = groups_combobox;

	ui->summary_hbuttonbox = summary_hbuttonbox;
	ui->summary_name_label = summary_name_label;
	ui->summary_group_label = summary_group_label;
	ui->summary_table = summary_table;
	ui->summary_vbox = summary_vbox;

#ifdef HAVE_GCONF
	client = gconf_client_get_default ();
	search = gconf_client_get_string (client, GCONF_KEY_SEARCH, NULL);
	if (!search) {
		gconf_client_set_string (
			client, GCONF_KEY_SEARCH, "entry", NULL);
	} else {
		if (strcmp (search, "alphatab") == 0) {
			gtk_widget_hide (search_entry_hbox);
			gtk_widget_show (search_tab_hbox);
		}
		g_free (search);
	}
	gconf_client_add_dir (client, GCONF_PATH, GCONF_CLIENT_PRELOAD_NONE,
		NULL);
	gconf_client_notify_add (client, GCONF_KEY_SEARCH,
		contacts_gconf_search_cb, data, NULL, NULL);

	width = gconf_client_get_int (client, GCONF_PATH "/width", NULL);
	height = gconf_client_get_int (client, GCONF_PATH "/height", NULL);
	gtk_window_set_default_size (GTK_WINDOW (main_window), width, height);
#endif

}
Ejemplo n.º 13
0
Archivo: gui.c Proyecto: rosedu/osmo
void 
gui_create_about(GtkWidget *notebook) {

GtkWidget *vbox1;
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *logo_area;
GdkPixbuf *logo;
GtkWidget *viewport;
GtkWidget *hbuttonbox;
GSList    *radiobutton_group = NULL;

    label = gtk_label_new(NULL);
    gtk_label_set_angle (GTK_LABEL(label), -90.0);
    gtk_label_set_markup (GTK_LABEL (label), _("About"));
 
    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_container_set_border_width (GTK_CONTAINER (vbox1), 8);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox1, label);

    logo_area = gtk_image_new();
    logo = gdk_pixbuf_new_from_inline(-1, osmo_logo, FALSE, NULL);
    gtk_widget_show(logo_area);
    gtk_box_pack_start (GTK_BOX (vbox1), logo_area, FALSE, TRUE, 0);

#ifndef REV
    sprintf(tmpbuf, "%s %s", _("version"), VERSION);
#else
    sprintf(tmpbuf, "%s %d", _("SVN revision"), REV);
#endif

    label = gtk_label_new(tmpbuf);
    gtk_widget_show (label);
    gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, TRUE, 4);

    gtk_image_set_from_pixbuf (GTK_IMAGE (logo_area), logo);

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 4);

    /*--------------------------------------------------------------------------*/

    hbuttonbox = gtk_hbutton_box_new ();
    gtk_widget_show (hbuttonbox);
    gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox, FALSE, TRUE, 0);
    gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);

    about_radiobutton = gui_image_label_radio_button(_("About"), osmo_stock_about);
    gtk_widget_show (about_radiobutton);

    gtk_button_set_relief (GTK_BUTTON (about_radiobutton), GTK_RELIEF_NONE);  
    GTK_WIDGET_UNSET_FLAGS(about_radiobutton, GTK_CAN_FOCUS);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (about_radiobutton), radiobutton_group);
    radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (about_radiobutton));
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (about_radiobutton), TRUE);
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (about_radiobutton), FALSE);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), about_radiobutton);

    g_signal_connect (G_OBJECT (about_radiobutton), "released",
                      G_CALLBACK(button_released_cb), NULL);

    help_radiobutton = gui_image_label_radio_button(_("Key shortcuts"), osmo_stock_help);
    gtk_widget_show (help_radiobutton);
    gtk_button_set_relief (GTK_BUTTON (help_radiobutton), GTK_RELIEF_NONE);  
    GTK_WIDGET_UNSET_FLAGS(help_radiobutton, GTK_CAN_FOCUS);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (help_radiobutton), radiobutton_group);
    radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (help_radiobutton));
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (help_radiobutton), FALSE);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), help_radiobutton);

    g_signal_connect (G_OBJECT (help_radiobutton), "released",
                      G_CALLBACK(button_released_cb), NULL);

    license_radiobutton = gui_image_label_radio_button(_("License"), osmo_stock_license);
    gtk_widget_show (license_radiobutton);
    gtk_button_set_relief (GTK_BUTTON (license_radiobutton), GTK_RELIEF_NONE);  
    GTK_WIDGET_UNSET_FLAGS(license_radiobutton, GTK_CAN_FOCUS);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (license_radiobutton), radiobutton_group);
    radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (license_radiobutton));
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (license_radiobutton), FALSE);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), license_radiobutton);

    g_signal_connect (G_OBJECT (license_radiobutton), "released",
                      G_CALLBACK(button_released_cb), NULL);

    /*--------------------------------------------------------------------------*/

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 4);

    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_box_pack_start (GTK_BOX (vbox1), scrolled_window, TRUE, TRUE, 0);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_widget_show (scrolled_window);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_set_border_width (GTK_CONTAINER (viewport), 0);
    gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);

    entry_buffer = gtk_text_buffer_new (NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &entry_iter, 0);
    gtk_text_buffer_create_tag (entry_buffer, "bold", "weight", PANGO_WEIGHT_ULTRABOLD, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "big", "size", 16 * PANGO_SCALE, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "italic", "style", PANGO_STYLE_ITALIC, NULL);
    gtk_text_buffer_create_tag (entry_buffer, "center", "justification", GTK_JUSTIFY_CENTER, NULL);
    gtk_text_buffer_get_iter_at_offset (entry_buffer, &entry_iter, 0);

    about_textview = gtk_text_view_new_with_buffer (entry_buffer);
    gtk_container_set_border_width (GTK_CONTAINER (about_textview), 1);
    gtk_text_view_set_editable(GTK_TEXT_VIEW (about_textview), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (about_textview), FALSE);
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (about_textview), GTK_WRAP_WORD);
    gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(about_textview), 2);
    gtk_text_view_set_left_margin(GTK_TEXT_VIEW(about_textview), 6);
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(about_textview), 6);
    gtk_widget_show (about_textview);
    gtk_container_add (GTK_CONTAINER (viewport), about_textview);

    gui_url_setup(&about_links_list, &about_link_index, about_textview);

    display_about();
}
Ejemplo n.º 14
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_radio_button_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean state, indicator;
  gchar *group_name;
  GSList *group = NULL, *current_group;
  GbFindGroupData find_group_data;

  if (gb_toolbar_is_toolbar_button (widget))
    {
      gb_toolbar_input_child_label (widget, data, Label);
      gb_toolbar_input_child_icon (widget, data, Icon);
    }
  else
    {
      gb_widget_input_child_label (widget, data, Label);
    }

  state = gb_widget_input_bool (data, State);
  if (data->apply)
    {
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), state);
      if (state)
	data->widget_data->flags |= GLADE_ACTIVE;
      else
	data->widget_data->flags &= ~GLADE_ACTIVE;
    }

  indicator = gb_widget_input_bool (data, Indicator);
  if (data->apply)
    gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (widget), indicator);

  /* Find any widgets in given group and set this widgets group.
     If group is NULL try to find radiobuttons with same parent and use
     their group. If these don't succeed, set group to NULL. */
  group_name = gb_widget_input_combo (data, Group);
  if (data->apply)
    {
      if (group_name && group_name[0] == '\0')
	group_name = NULL;
      current_group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget));

      if (group_name == NULL)
	gtk_container_foreach (GTK_CONTAINER (widget->parent),
			       (GtkCallback) find_parents_group, &group);
      else
	{
	  find_group_data.group_name = group_name;
	  find_group_data.group = NULL;
	  find_group (gtk_widget_get_toplevel (widget), &find_group_data);
	  group = find_group_data.group;
	}

      g_free (gtk_object_get_data (GTK_OBJECT (widget), Group));
      gtk_object_set_data (GTK_OBJECT (widget), Group, g_strdup (group_name));

      /* This crashes if we set the group to NULL, so we have to reset the
         group ourself. We only set the group if it has changed. */
      if (group)
	{
	  if (group != current_group)
	    {
	      if (current_group->data == widget)
		current_group = current_group->next;
	      gtk_radio_button_set_group (GTK_RADIO_BUTTON (widget), group);
	      gb_radio_button_update_radio_group (current_group);
	      gb_radio_button_update_radio_group (gtk_radio_button_group (GTK_RADIO_BUTTON (widget)));
	    }
	}
      else
	{
	  if (g_slist_length (current_group) != 1)
	    {
	      current_group = gb_radio_button_reset_radio_group (widget);
	      gb_radio_button_update_radio_group (current_group);
	      gb_radio_button_update_radio_group (gtk_radio_button_group (GTK_RADIO_BUTTON (widget)));
	    }
	}
    }
}
Ejemplo n.º 15
0
GtkWidget *create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *notebook1;
  GtkWidget *table1;
  GtkWidget *radioCQ;
  GSList *radioCQ_group = NULL;
  GtkWidget *radioCBR;
  GtkWidget *radio2Pass;
  GtkWidget *entryCQ;
  GtkWidget *entryCBR;
  GtkWidget *entry2Pass;
  GtkWidget *label1;
  GtkWidget *table2;
  GtkWidget *label5;
  GtkWidget *label6;
  GtkWidget *label7;
  GtkObject *spinbuttonMaxIFrame_adj;
  GtkWidget *spinbuttonMaxIFrame;
  GtkWidget *label8;
  GtkObject *spinbuttonMinIFrame_adj;
  GtkWidget *spinbuttonMinIFrame;
  GtkWidget *optionME;
  GtkWidget *menu4;
  GtkWidget *_0___none1;
  GtkWidget *_1__very_low1;
  GtkWidget *_2__low1;
  GtkWidget *_3__medium1;
  GtkWidget *_4__high1;
  GtkWidget *_5__very_high1;
  GtkWidget *_6__ultra_high1;
  GtkWidget *optionQzer;
  GtkWidget *menu5;
  GtkWidget *h263_quantizer1;
  GtkWidget *mpeg_quantizer1;
  GtkWidget *label2;
  GtkWidget *table3;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *label11;
  GtkWidget *label12;
  GtkObject *spinImin_adj;
  GtkWidget *spinImin;
  GtkObject *spinImax_adj;
  GtkWidget *spinImax;
  GtkObject *spinPmin_adj;
  GtkWidget *spinPmin;
  GtkObject *spinPmax_adj;
  GtkWidget *spinPmax;
  GtkWidget *label3;
  GtkWidget *label13;
  GtkWidget *label4;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

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

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

  notebook1 = gtk_notebook_new ();
  gtk_widget_show (notebook1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook1, TRUE, TRUE, 0);

  table1 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table1);
  gtk_container_add (GTK_CONTAINER (notebook1), table1);

  radioCQ = gtk_radio_button_new_with_mnemonic (NULL, _("Constant Quantizer"));
  gtk_widget_show (radioCQ);
  gtk_table_attach (GTK_TABLE (table1), radioCQ, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioCQ), radioCQ_group);
  radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioCQ));

  radioCBR = gtk_radio_button_new_with_mnemonic (NULL, _("Constant Bitrate (kbps)"));
  gtk_widget_show (radioCBR);
  gtk_table_attach (GTK_TABLE (table1), radioCBR, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioCBR), radioCQ_group);
  radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioCBR));

  radio2Pass = gtk_radio_button_new_with_mnemonic (NULL, _("Dual pass (MBytes)"));
  gtk_widget_show (radio2Pass);
  gtk_table_attach (GTK_TABLE (table1), radio2Pass, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio2Pass), radioCQ_group);
  radioCQ_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio2Pass));

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

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

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

  label1 = gtk_label_new (_("Basic"));
  gtk_widget_show (label1);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

  table2 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (notebook1), table2);

  label5 = gtk_label_new (_("Motion Search"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 0, 1,
                    (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);

  label6 = gtk_label_new (_("Quantization"));
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 1, 2,
                    (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);

  label7 = gtk_label_new (_("Max I frame interval "));
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 2, 3,
                    (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);

  spinbuttonMaxIFrame_adj = gtk_adjustment_new (300, 0, 600, 1, 10, 10);
  spinbuttonMaxIFrame = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonMaxIFrame_adj), 1, 0);
  gtk_widget_show (spinbuttonMaxIFrame);
  gtk_table_attach (GTK_TABLE (table2), spinbuttonMaxIFrame, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonMaxIFrame), TRUE);

  label8 = gtk_label_new (_("Min I frame interval"));
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table2), label8, 0, 1, 3, 4,
                    (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);

  spinbuttonMinIFrame_adj = gtk_adjustment_new (1, 0, 600, 1, 10, 10);
  spinbuttonMinIFrame = gtk_spin_button_new (GTK_ADJUSTMENT (spinbuttonMinIFrame_adj), 1, 0);
  gtk_widget_show (spinbuttonMinIFrame);
  gtk_table_attach (GTK_TABLE (table2), spinbuttonMinIFrame, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbuttonMinIFrame), TRUE);

  optionME = gtk_option_menu_new ();
  gtk_widget_show (optionME);
  gtk_table_attach (GTK_TABLE (table2), optionME, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  menu4 = gtk_menu_new ();

  _0___none1 = gtk_menu_item_new_with_mnemonic (_("0 - None"));
  gtk_widget_show (_0___none1);
  gtk_container_add (GTK_CONTAINER (menu4), _0___none1);

  _1__very_low1 = gtk_menu_item_new_with_mnemonic (_("1- Very low"));
  gtk_widget_show (_1__very_low1);
  gtk_container_add (GTK_CONTAINER (menu4), _1__very_low1);

  _2__low1 = gtk_menu_item_new_with_mnemonic (_("2- Low"));
  gtk_widget_show (_2__low1);
  gtk_container_add (GTK_CONTAINER (menu4), _2__low1);

  _3__medium1 = gtk_menu_item_new_with_mnemonic (_("3- Medium"));
  gtk_widget_show (_3__medium1);
  gtk_container_add (GTK_CONTAINER (menu4), _3__medium1);

  _4__high1 = gtk_menu_item_new_with_mnemonic (_("4- High"));
  gtk_widget_show (_4__high1);
  gtk_container_add (GTK_CONTAINER (menu4), _4__high1);

  _5__very_high1 = gtk_menu_item_new_with_mnemonic (_("5- Very High"));
  gtk_widget_show (_5__very_high1);
  gtk_container_add (GTK_CONTAINER (menu4), _5__very_high1);

  _6__ultra_high1 = gtk_menu_item_new_with_mnemonic (_("6- Ultra High"));
  gtk_widget_show (_6__ultra_high1);
  gtk_container_add (GTK_CONTAINER (menu4), _6__ultra_high1);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionME), menu4);

  optionQzer = gtk_option_menu_new ();
  gtk_widget_show (optionQzer);
  gtk_table_attach (GTK_TABLE (table2), optionQzer, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  menu5 = gtk_menu_new ();

 h263_quantizer1 = gtk_menu_item_new_with_mnemonic (_("H263 Quantizer"));
  gtk_widget_show (h263_quantizer1);
  gtk_container_add (GTK_CONTAINER (menu5), h263_quantizer1);


  mpeg_quantizer1 = gtk_menu_item_new_with_mnemonic (_("MPEG Quantizer"));
  gtk_widget_show (mpeg_quantizer1);
  gtk_container_add (GTK_CONTAINER (menu5), mpeg_quantizer1);


  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionQzer), menu5);

  label2 = gtk_label_new (_("Advanced"));
  gtk_widget_show (label2);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  table3 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table3);
  gtk_container_add (GTK_CONTAINER (notebook1), table3);

  label9 = gtk_label_new (_("Min I Frame Qzer"));
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table3), label9, 0, 1, 0, 1,
                    (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);

  label10 = gtk_label_new (_("Max I Frame Qzer"));
  gtk_widget_show (label10);
  gtk_table_attach (GTK_TABLE (table3), label10, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);

  label11 = gtk_label_new (_("Min P Frame Qzer"));
  gtk_widget_show (label11);
  gtk_table_attach (GTK_TABLE (table3), label11, 0, 1, 2, 3,
                    (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);

  label12 = gtk_label_new (_("Max P Frame Qzer"));
  gtk_widget_show (label12);
  gtk_table_attach (GTK_TABLE (table3), label12, 0, 1, 3, 4,
                    (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);

  spinImin_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 10);
  spinImin = gtk_spin_button_new (GTK_ADJUSTMENT (spinImin_adj), 1, 0);
  gtk_widget_show (spinImin);
  gtk_table_attach (GTK_TABLE (table3), spinImin, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinImin), TRUE);

  spinImax_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 10);
  spinImax = gtk_spin_button_new (GTK_ADJUSTMENT (spinImax_adj), 1, 0);
  gtk_widget_show (spinImax);
  gtk_table_attach (GTK_TABLE (table3), spinImax, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinImax), TRUE);

  spinPmin_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 10);
  spinPmin = gtk_spin_button_new (GTK_ADJUSTMENT (spinPmin_adj), 1, 0);
  gtk_widget_show (spinPmin);
  gtk_table_attach (GTK_TABLE (table3), spinPmin, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPmin), TRUE);

  spinPmax_adj = gtk_adjustment_new (2, 2, 31, 1, 10, 10);
  spinPmax = gtk_spin_button_new (GTK_ADJUSTMENT (spinPmax_adj), 1, 0);
  gtk_widget_show (spinPmax);
  gtk_table_attach (GTK_TABLE (table3), spinPmax, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinPmax), TRUE);

  label3 = gtk_label_new (_("Quantizer"));
  gtk_widget_show (label3);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label3);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);

  label13 = gtk_label_new (_("Not Yet!"));
  gtk_widget_show (label13);
  gtk_container_add (GTK_CONTAINER (notebook1), label13);
  gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_LEFT);

  label4 = gtk_label_new (_("B Frames"));
  gtk_widget_show (label4);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label4);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);

  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, notebook1, "notebook1");
  GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
  GLADE_HOOKUP_OBJECT (dialog1, radioCQ, "radioCQ");
  GLADE_HOOKUP_OBJECT (dialog1, radioCBR, "radioCBR");
  GLADE_HOOKUP_OBJECT (dialog1, radio2Pass, "radio2Pass");
  GLADE_HOOKUP_OBJECT (dialog1, entryCQ, "entryCQ");
  GLADE_HOOKUP_OBJECT (dialog1, entryCBR, "entryCBR");
  GLADE_HOOKUP_OBJECT (dialog1, entry2Pass, "entry2Pass");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, table2, "table2");
  GLADE_HOOKUP_OBJECT (dialog1, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialog1, label6, "label6");
  GLADE_HOOKUP_OBJECT (dialog1, label7, "label7");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonMaxIFrame, "spinbuttonMaxIFrame");
  GLADE_HOOKUP_OBJECT (dialog1, label8, "label8");
  GLADE_HOOKUP_OBJECT (dialog1, spinbuttonMinIFrame, "spinbuttonMinIFrame");
  GLADE_HOOKUP_OBJECT (dialog1, optionME, "optionME");
  GLADE_HOOKUP_OBJECT (dialog1, menu4, "menu4");
  GLADE_HOOKUP_OBJECT (dialog1, _0___none1, "_0___none1");
  GLADE_HOOKUP_OBJECT (dialog1, _1__very_low1, "_1__very_low1");
  GLADE_HOOKUP_OBJECT (dialog1, _2__low1, "_2__low1");
  GLADE_HOOKUP_OBJECT (dialog1, _3__medium1, "_3__medium1");
  GLADE_HOOKUP_OBJECT (dialog1, _4__high1, "_4__high1");
  GLADE_HOOKUP_OBJECT (dialog1, _5__very_high1, "_5__very_high1");
  GLADE_HOOKUP_OBJECT (dialog1, _6__ultra_high1, "_6__ultra_high1");
  GLADE_HOOKUP_OBJECT (dialog1, optionQzer, "optionQzer");
  GLADE_HOOKUP_OBJECT (dialog1, menu5, "menu5");
  GLADE_HOOKUP_OBJECT (dialog1, h263_quantizer1, "h263_quantizer1");
  GLADE_HOOKUP_OBJECT (dialog1, mpeg_quantizer1, "mpeg_quantizer1");
  GLADE_HOOKUP_OBJECT (dialog1, label2, "label2");
  GLADE_HOOKUP_OBJECT (dialog1, table3, "table3");
  GLADE_HOOKUP_OBJECT (dialog1, label9, "label9");
  GLADE_HOOKUP_OBJECT (dialog1, label10, "label10");
  GLADE_HOOKUP_OBJECT (dialog1, label11, "label11");
  GLADE_HOOKUP_OBJECT (dialog1, label12, "label12");
  GLADE_HOOKUP_OBJECT (dialog1, spinImin, "spinImin");
  GLADE_HOOKUP_OBJECT (dialog1, spinImax, "spinImax");
  GLADE_HOOKUP_OBJECT (dialog1, spinPmin, "spinPmin");
  GLADE_HOOKUP_OBJECT (dialog1, spinPmax, "spinPmax");
  GLADE_HOOKUP_OBJECT (dialog1, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialog1, label13, "label13");
  GLADE_HOOKUP_OBJECT (dialog1, label4, "label4");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
Ejemplo n.º 16
0
static GtkWidget *
create_extra_widget (DialogData *data)
{
	GtkWidget *vbox1;
	GtkWidget *hbox28;
	GtkWidget *vbox19;
	GtkWidget *e_files_label;
	GtkWidget *hbox29;
	GtkWidget *label47;
	GtkWidget *table1;
	GSList    *e_files_radiobutton_group = NULL;
	GtkWidget *vbox20;
	GtkWidget *e_actions_label;
	GtkWidget *hbox30;
	GtkWidget *label48;
	GtkWidget *vbox15;

	vbox1 = gtk_vbox_new (FALSE, 6);
	gtk_container_set_border_width (GTK_CONTAINER (vbox1), 0);

	hbox28 = gtk_hbox_new (FALSE, 12);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox28, TRUE, TRUE, 0);

	vbox19 = gtk_vbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (hbox28), vbox19, TRUE, TRUE, 0);

	e_files_label = gtk_label_new ("");
	set_bold_label (e_files_label, _("Extract"));
	gtk_box_pack_start (GTK_BOX (vbox19), e_files_label, FALSE, FALSE, 0);
	gtk_label_set_justify (GTK_LABEL (e_files_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (e_files_label), 0, 0.5);

	hbox29 = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox19), hbox29, TRUE, TRUE, 0);

	label47 = gtk_label_new ("    ");
	gtk_box_pack_start (GTK_BOX (hbox29), label47, FALSE, FALSE, 0);
	gtk_label_set_justify (GTK_LABEL (label47), GTK_JUSTIFY_LEFT);

	table1 = gtk_table_new (3, 2, FALSE);
	gtk_box_pack_start (GTK_BOX (hbox29), table1, TRUE, TRUE, 0);
	gtk_table_set_row_spacings (GTK_TABLE (table1), 6);
	gtk_table_set_col_spacings (GTK_TABLE (table1), 6);

	data->e_files_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("_Files:"));
	gtk_table_attach (GTK_TABLE (table1), data->e_files_radiobutton, 0, 1, 2, 3,
			  (GtkAttachOptions) (GTK_FILL),
			  (GtkAttachOptions) (0), 0, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (data->e_files_radiobutton), e_files_radiobutton_group);
	e_files_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (data->e_files_radiobutton));

	data->e_files_entry = gtk_entry_new ();
	gtk_table_attach (GTK_TABLE (table1), data->e_files_entry, 1, 2, 2, 3,
			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			  (GtkAttachOptions) (0), 0, 0);
	gtk_widget_set_tooltip_text (data->e_files_entry, _("example: *.txt; *.doc"));
	gtk_entry_set_activates_default (GTK_ENTRY (data->e_files_entry), TRUE);

	data->e_all_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("_All files"));
	gtk_table_attach (GTK_TABLE (table1), data->e_all_radiobutton, 0, 2, 0, 1,
			  (GtkAttachOptions) (GTK_FILL),
			  (GtkAttachOptions) (0), 0, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (data->e_all_radiobutton), e_files_radiobutton_group);
	e_files_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (data->e_all_radiobutton));

	data->e_selected_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("_Selected files"));
	gtk_table_attach (GTK_TABLE (table1), data->e_selected_radiobutton, 0, 2, 1, 2,
			  (GtkAttachOptions) (GTK_FILL),
			  (GtkAttachOptions) (0), 0, 0);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (data->e_selected_radiobutton), e_files_radiobutton_group);
	e_files_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (data->e_selected_radiobutton));

	vbox20 = gtk_vbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (hbox28), vbox20, TRUE, TRUE, 0);

	e_actions_label = gtk_label_new ("");
	set_bold_label (e_actions_label, _("Actions"));
	gtk_box_pack_start (GTK_BOX (vbox20), e_actions_label, FALSE, FALSE, 0);
	gtk_label_set_use_markup (GTK_LABEL (e_actions_label), TRUE);
	gtk_label_set_justify (GTK_LABEL (e_actions_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (e_actions_label), 0, 0.5);

	hbox30 = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox20), hbox30, TRUE, TRUE, 0);

	label48 = gtk_label_new ("    ");
	gtk_box_pack_start (GTK_BOX (hbox30), label48, FALSE, FALSE, 0);
	gtk_label_set_justify (GTK_LABEL (label48), GTK_JUSTIFY_LEFT);

	vbox15 = gtk_vbox_new (FALSE, 6);
	gtk_box_pack_start (GTK_BOX (hbox30), vbox15, TRUE, TRUE, 0);

	data->e_recreate_dir_checkbutton = gtk_check_button_new_with_mnemonic (_("Re-crea_te folders"));
	gtk_box_pack_start (GTK_BOX (vbox15), data->e_recreate_dir_checkbutton, FALSE, FALSE, 0);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_recreate_dir_checkbutton), TRUE);

	data->e_overwrite_checkbutton = gtk_check_button_new_with_mnemonic (_("Over_write existing files"));
	gtk_box_pack_start (GTK_BOX (vbox15), data->e_overwrite_checkbutton, FALSE, FALSE, 0);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_overwrite_checkbutton), TRUE);

	data->e_not_newer_checkbutton = gtk_check_button_new_with_mnemonic (_("Do not e_xtract older files"));
	gtk_box_pack_start (GTK_BOX (vbox15), data->e_not_newer_checkbutton, FALSE, FALSE, 0);

	gtk_widget_show_all (vbox1);

	return vbox1;
}
Ejemplo n.º 17
0
ImportAssistant::ImportAssistant(WindowReferences * references_window, WindowStyles * styles_window, WindowCheckKeyterms * check_keyterms_window, WindowsOutpost * windows_outpost) :
  AssistantBase(_("Import"), _("import"))
// Import assistant.
{
  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);
  
  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("This helps you importing data"));

  // Configuration and initialization.
  extern Settings *settings;
  ustring project = settings->genconfig.project_get();
  my_references_window = references_window;
  my_styles_window = styles_window;
  my_check_keyterms_window = check_keyterms_window;
  my_windows_outpost = windows_outpost;
  import_notes = false;
  import_keyterms = false;

  // Build the GUI for the task selector.
  vbox_select_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_select_type);
  page_number_select_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_select_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_select_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_select_type, _("What would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_select_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_select_type, true);

  GSList *radiobutton_select_type_group = NULL;

  radiobutton_select_type_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Bible"));
  gtk_widget_show (radiobutton_select_type_bible);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible));

  radiobutton_select_type_references = gtk_radio_button_new_with_mnemonic (NULL, _("References"));
  gtk_widget_show (radiobutton_select_type_references);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_references, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_references), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_references));

  // Importing references only works when the references window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_references, references_window != NULL);
  
  radiobutton_select_type_stylesheet = gtk_radio_button_new_with_mnemonic (NULL, _("Stylesheet"));
  gtk_widget_show (radiobutton_select_type_stylesheet);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_stylesheet, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_stylesheet), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_stylesheet));

  // Importing styles only works when the styles window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_stylesheet, my_styles_window != NULL);

  radiobutton_select_type_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Notes"));
  gtk_widget_show (radiobutton_select_type_notes);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes));

  radiobutton_select_type_keyterms = gtk_radio_button_new_with_mnemonic (NULL, _("Keyterms"));
  gtk_widget_show (radiobutton_select_type_keyterms);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_keyterms, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_keyterms), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_keyterms));

  // Importing keyterms only works when the check keyterms window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_keyterms, my_check_keyterms_window != NULL);
  
  Shortcuts shortcuts_select_type (0);
  shortcuts_select_type.button (radiobutton_select_type_bible);
  shortcuts_select_type.button (radiobutton_select_type_references);
  shortcuts_select_type.button (radiobutton_select_type_stylesheet);
  shortcuts_select_type.button (radiobutton_select_type_notes);
  shortcuts_select_type.button (radiobutton_select_type_keyterms);
  shortcuts_select_type.consider_assistant();
  shortcuts_select_type.process();

  // Confirm or change Bible to import into.
  vbox_bible_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_bible_name);
  page_number_bible_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_name, _("Is this the right Bible to import into?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, true);

  label_project_name = gtk_label_new (_("Bible name"));
  gtk_widget_show (label_project_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), label_project_name, FALSE, FALSE, 0);

  button_bible_name = gtk_button_new ();
  gtk_widget_show (button_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), button_bible_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_bible_name, "clicked", G_CALLBACK (on_button_bible_name_clicked), gpointer (this));

  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label12;

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_bible_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label12 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (hbox1), label12, FALSE, FALSE, 0);

  Shortcuts shortcuts_bible_name (0);
  shortcuts_bible_name.label (label12);
  shortcuts_bible_name.consider_assistant();
  shortcuts_bible_name.process();

  // Select what type of Bible data to import.
  vbox_bible_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_bible_type);
  page_number_bible_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_type, _("What type of data would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_type, true);

  GSList *radiobutton_bible_type_group = NULL;

  radiobutton_bible_usfm = gtk_radio_button_new_with_mnemonic (NULL, _("Unified Standard Format Markers (USFM)"));
  gtk_widget_show (radiobutton_bible_usfm);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_usfm, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_usfm), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_usfm));

  radiobutton_bible_bibleworks = gtk_radio_button_new_with_mnemonic (NULL, _("BibleWorks Exported Database"));
  gtk_widget_show (radiobutton_bible_bibleworks);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_bibleworks, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_bibleworks), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_bibleworks));

  radiobutton_bible_online_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Online Bible Text"));
  gtk_widget_show (radiobutton_bible_online_bible);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_online_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_online_bible), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_online_bible));

  radiobutton_bible_raw_text = gtk_radio_button_new_with_mnemonic (NULL, _("Raw Text"));
  gtk_widget_show (radiobutton_bible_raw_text);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_raw_text, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_raw_text), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_raw_text));

  Shortcuts shortcuts_select_bible_type (0);
  shortcuts_select_bible_type.button (radiobutton_bible_usfm);
  shortcuts_select_bible_type.button (radiobutton_bible_bibleworks);
  shortcuts_select_bible_type.button (radiobutton_bible_online_bible);
  shortcuts_select_bible_type.button (radiobutton_bible_raw_text);
  shortcuts_select_bible_type.consider_assistant();
  shortcuts_select_bible_type.process();

  // Online Bible connection?
  label_online_bible_running = gtk_label_new ("");
  gtk_widget_show (label_online_bible_running);
  page_number_online_bible_running = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_online_bible_running);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_online_bible_running, _("Connected to the Online Bible?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_online_bible_running, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_online_bible_running, false);

  // In case there's no data in the project, the Online Bible won't get connected.
  // Therefore connect manually.
  if (online_bible_is_running ()) {
    my_windows_outpost->OnlineBibleReferenceGet ();
  }

  // Online Bible to import.
  vbox_online_bible_bible = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_online_bible_bible);
  page_number_online_bible_bible = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_online_bible_bible);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_online_bible_bible, _("Which Bible would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_online_bible_bible, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_online_bible_bible, false);

  combobox_online_bible_bible = gtk_combo_box_new_text ();
  gtk_widget_show (combobox_online_bible_bible);
  gtk_box_pack_start (GTK_BOX (vbox_online_bible_bible), combobox_online_bible_bible, false, false, 0);

  g_signal_connect ((gpointer) combobox_online_bible_bible, "changed", G_CALLBACK (on_combobox_online_bible_bible_changed), gpointer (this));

  // Select files to import from.
  vbox_files = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_files);
  page_number_files = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_files);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_files), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_files, _("Which file or files would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_files, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_files, false);

  button_files = gtk_button_new ();
  gtk_widget_show (button_files);
  gtk_box_pack_start (GTK_BOX (vbox_files), button_files, FALSE, FALSE, 0);

  GtkWidget * alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (button_files), alignment2);

  GtkWidget * hbox2 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox2);
  gtk_container_add (GTK_CONTAINER (alignment2), hbox2);

  GtkWidget * image2 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox2), image2, FALSE, FALSE, 0);

  GtkWidget * label = gtk_label_new_with_mnemonic (_("Select files"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_files, "clicked", G_CALLBACK (on_button_files_clicked), gpointer(this));

  label_files = gtk_label_new ("");
  gtk_widget_show (label_files);
  gtk_box_pack_start (GTK_BOX (vbox_files), label_files, FALSE, FALSE, 0);

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Import about to be done"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("The import is about to be done"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new ("");
  gtk_widget_show (label_progress);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new (_("Import done"));
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("Ready"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}
Ejemplo n.º 18
0
Archivo: about.c Proyecto: rosedu/osmo
void
gui_create_about (GtkWidget *vbox_top, GUI *appGUI)
{
	GtkWidget *hbox = NULL, *vbox = NULL;
	GtkWidget *label;
	GtkWidget *hseparator;
	GtkWidget *logo_area;
	GdkPixbuf *logo, *logo_scaled = NULL;
	GtkWidget *viewport;
	GtkWidget *hbuttonbox = NULL;
	GSList    *radiobutton_group = NULL;
	char *str;

	appGUI->about_counter = 0;
	appGUI->about_vbox = GTK_BOX (vbox_top);

	logo_area = gtk_image_new ();
	logo = gdk_pixbuf_new_from_inline (-1, osmo_logo, FALSE, NULL);
	gtk_widget_show (logo_area);
	gtk_box_pack_start (GTK_BOX (vbox_top), logo_area, FALSE, TRUE, 0);

	if (appGUI->tiny_gui == TRUE) {
		logo_scaled = gdk_pixbuf_scale_simple (logo,
		                                       gdk_pixbuf_get_width (logo) / 2,
		                                       gdk_pixbuf_get_height (logo) / 2,
		                                       GDK_INTERP_HYPER);
	}

#ifndef REV
	str = g_strdup_printf ("%s %s", _("version"), VERSION);
#else
	str = g_strdup_printf ("%s %d", _("SVN revision"), REV);
#endif

	label = gtk_label_new (str);
	g_free (str);
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox_top), label, FALSE, TRUE, 4);

	if (logo_scaled != NULL) {
		gtk_image_set_from_pixbuf (GTK_IMAGE (logo_area), logo_scaled);
		g_object_unref (logo_scaled);
	} else {
		gtk_image_set_from_pixbuf (GTK_IMAGE (logo_area), logo);
		g_object_unref (logo);
	}


	/*--------------------------------------------------------------------------*/

	vbox = gtk_vbox_new (FALSE, 4);
	gtk_widget_show (vbox);
	gtk_box_pack_start (GTK_BOX (vbox_top), vbox, FALSE, TRUE, 0);

	hseparator = gtk_hseparator_new ();
	gtk_widget_show (hseparator);
	gtk_box_pack_start (GTK_BOX (vbox), hseparator, FALSE, TRUE, 0);

	if (appGUI->tiny_gui == TRUE) {
		hbox = gtk_hbox_new (FALSE, 0);
		gtk_widget_show (hbox);
		gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
	} else {
		hbuttonbox = gtk_hbutton_box_new ();
		gtk_widget_show (hbuttonbox);
		gtk_box_pack_start (GTK_BOX (vbox), hbuttonbox, FALSE, TRUE, 0);
		gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);
	}

	if (appGUI->tiny_gui == TRUE) {
		appGUI->about_radiobutton = utl_gui_stock_label_radio_button (NULL, OSMO_STOCK_ABOUT, GTK_ICON_SIZE_LARGE_TOOLBAR);
	} else {
		appGUI->about_radiobutton = utl_gui_stock_label_radio_button (_("About"), OSMO_STOCK_ABOUT, GTK_ICON_SIZE_LARGE_TOOLBAR);
		gtk_container_add (GTK_CONTAINER (hbuttonbox), appGUI->about_radiobutton);
	}
	gtk_widget_show (appGUI->about_radiobutton);

	gtk_button_set_relief (GTK_BUTTON (appGUI->about_radiobutton), GTK_RELIEF_NONE);
	GTK_WIDGET_UNSET_FLAGS (appGUI->about_radiobutton, GTK_CAN_FOCUS);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (appGUI->about_radiobutton), radiobutton_group);
	radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (appGUI->about_radiobutton));
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (appGUI->about_radiobutton), TRUE);
	gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (appGUI->about_radiobutton), FALSE);

	g_signal_connect (G_OBJECT (appGUI->about_radiobutton), "released",
	                  G_CALLBACK (button_released_cb), appGUI);

	if (appGUI->tiny_gui == TRUE) {
		appGUI->help_radiobutton = utl_gui_stock_label_radio_button (NULL, OSMO_STOCK_HELP, GTK_ICON_SIZE_LARGE_TOOLBAR);
	} else {
		appGUI->help_radiobutton = utl_gui_stock_label_radio_button (_("Key shortcuts"), OSMO_STOCK_HELP, GTK_ICON_SIZE_LARGE_TOOLBAR);
		gtk_container_add (GTK_CONTAINER (hbuttonbox), appGUI->help_radiobutton);
	}
	gtk_widget_show (appGUI->help_radiobutton);
	gtk_button_set_relief (GTK_BUTTON (appGUI->help_radiobutton), GTK_RELIEF_NONE);
	GTK_WIDGET_UNSET_FLAGS (appGUI->help_radiobutton, GTK_CAN_FOCUS);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (appGUI->help_radiobutton), radiobutton_group);
	radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (appGUI->help_radiobutton));
	gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (appGUI->help_radiobutton), FALSE);

	g_signal_connect (G_OBJECT (appGUI->help_radiobutton), "released",
	                  G_CALLBACK (button_released_cb), appGUI);

	if (appGUI->tiny_gui == TRUE) {
		appGUI->license_radiobutton = utl_gui_stock_label_radio_button (NULL, OSMO_STOCK_LICENSE, GTK_ICON_SIZE_LARGE_TOOLBAR);
	} else {
		appGUI->license_radiobutton = utl_gui_stock_label_radio_button (_("License"), OSMO_STOCK_LICENSE, GTK_ICON_SIZE_LARGE_TOOLBAR);
		gtk_container_add (GTK_CONTAINER (hbuttonbox), appGUI->license_radiobutton);
	}
	gtk_widget_show (appGUI->license_radiobutton);
	gtk_button_set_relief (GTK_BUTTON (appGUI->license_radiobutton), GTK_RELIEF_NONE);
	GTK_WIDGET_UNSET_FLAGS (appGUI->license_radiobutton, GTK_CAN_FOCUS);
	gtk_radio_button_set_group (GTK_RADIO_BUTTON (appGUI->license_radiobutton), radiobutton_group);
	radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (appGUI->license_radiobutton));
	gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (appGUI->license_radiobutton), FALSE);

	g_signal_connect (G_OBJECT (appGUI->license_radiobutton), "released",
	                  G_CALLBACK (button_released_cb), appGUI);

	if (appGUI->tiny_gui == TRUE) {
		gtk_box_pack_end (GTK_BOX (hbox), appGUI->license_radiobutton, FALSE, TRUE, 0);
		gtk_box_pack_end (GTK_BOX (hbox), appGUI->help_radiobutton, FALSE, TRUE, 0);
		gtk_box_pack_end (GTK_BOX (hbox), appGUI->about_radiobutton, FALSE, TRUE, 0);
	}

	hseparator = gtk_hseparator_new ();
	gtk_widget_show (hseparator);
	gtk_box_pack_start (GTK_BOX (vbox), hseparator, FALSE, TRUE, 0);

	/*--------------------------------------------------------------------------*/

	appGUI->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_box_pack_start (GTK_BOX (vbox_top), appGUI->scrolled_window, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (appGUI->scrolled_window),
	                                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_widget_show (appGUI->scrolled_window);

	viewport = gtk_viewport_new (NULL, NULL);
	gtk_widget_show (viewport);
	gtk_container_set_border_width (GTK_CONTAINER (viewport), 0);
	gtk_container_add (GTK_CONTAINER (appGUI->scrolled_window), viewport);

	appGUI->about_entry_buffer = gtk_text_buffer_new (NULL);
	gtk_text_buffer_get_iter_at_offset (appGUI->about_entry_buffer, &appGUI->about_entry_iter, 0);
	gtk_text_buffer_create_tag (appGUI->about_entry_buffer, "fixed", "family", "monospace", NULL);
	gtk_text_buffer_create_tag (appGUI->about_entry_buffer, "bold", "weight", PANGO_WEIGHT_ULTRABOLD, NULL);
	gtk_text_buffer_create_tag (appGUI->about_entry_buffer, "big", "size", 16 * PANGO_SCALE, NULL);
	gtk_text_buffer_create_tag (appGUI->about_entry_buffer, "italic", "style", PANGO_STYLE_ITALIC, NULL);
	gtk_text_buffer_create_tag (appGUI->about_entry_buffer, "center", "justification", GTK_JUSTIFY_CENTER, NULL);
	gtk_text_buffer_get_iter_at_offset (appGUI->about_entry_buffer, &appGUI->about_entry_iter, 0);

	appGUI->about_textview = gtk_text_view_new_with_buffer (appGUI->about_entry_buffer);
	gtk_container_set_border_width (GTK_CONTAINER (appGUI->about_textview), 1);
	gtk_text_view_set_editable (GTK_TEXT_VIEW (appGUI->about_textview), FALSE);
	gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (appGUI->about_textview), FALSE);
	gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (appGUI->about_textview), GTK_WRAP_WORD);
	gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (appGUI->about_textview), 2);
	gtk_text_view_set_left_margin (GTK_TEXT_VIEW (appGUI->about_textview), 6);
	gtk_text_view_set_right_margin (GTK_TEXT_VIEW (appGUI->about_textview), 6);
	gtk_widget_show (appGUI->about_textview);
	gtk_container_add (GTK_CONTAINER (viewport), appGUI->about_textview);

	utl_gui_url_setup (&appGUI->about_links_list, &appGUI->about_link_index, appGUI->about_textview, appGUI);

	display_about (appGUI);
}
Ejemplo n.º 19
0
void
contacts_create_export_window(GUI *appGUI) {

GtkWidget *vbox1;
GtkWidget *hbox1;
GtkWidget *vbox2;
GtkWidget *hbox2;
GtkWidget *vbox3;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *vbox4;
GtkWidget *vbox5;
GtkWidget *format_xhtml_radiobutton;
GSList    *format_radiobutton_group = NULL;
GtkWidget *label;
GtkWidget *vseparator;
GtkWidget *scrolledwindow;
GtkWidget *viewport;
GtkWidget *fields_table;
GtkWidget *hbox3;
GtkWidget *browse_dir_button;
GtkWidget *hseparator;
GtkWidget *hbuttonbox;
GtkWidget *hbuttonbox_s;
GtkWidget *cancel_button;
GtkWidget *select_all_button;
GtkWidget *select_none_button;
GtkWidget *invert_selection_button;
gint i;
gchar tmpbuf[BUFFER_SIZE];
static MESSAGE msg_export_field[CONTACTS_NUM_COLUMNS];
static MESSAGE msg_select[3]; /* select all, select none, select invert */

    appGUI->cnt->export_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (appGUI->cnt->export_window), _("Export contacts"));
    gtk_container_set_border_width (GTK_CONTAINER (appGUI->cnt->export_window), 6);

    gtk_window_move (GTK_WINDOW (appGUI->cnt->export_window), 
                     config.contacts_export_win_x, config.contacts_export_win_y);
    gtk_window_set_default_size (GTK_WINDOW(appGUI->cnt->export_window), 
                                 config.contacts_export_win_w, config.contacts_export_win_h);

    gtk_window_set_transient_for(GTK_WINDOW(appGUI->cnt->export_window), GTK_WINDOW(appGUI->main_window));
    gtk_window_set_modal(GTK_WINDOW(appGUI->cnt->export_window), TRUE);

    g_signal_connect (G_OBJECT (appGUI->cnt->export_window), "key_press_event", 
                      G_CALLBACK (export_key_press_cb), appGUI);

    g_signal_connect (G_OBJECT (appGUI->cnt->export_window), "delete_event", 
                      G_CALLBACK(export_window_close_cb), appGUI);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox1);
    gtk_container_add (GTK_CONTAINER (appGUI->cnt->export_window), vbox1);

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

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

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

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

    frame = gtk_frame_new (NULL);
    gtk_widget_show (frame);
    gtk_box_pack_start (GTK_BOX (vbox3), frame, FALSE, FALSE, 0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
    gtk_widget_show (alignment);
    gtk_container_add (GTK_CONTAINER (frame), alignment);
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

    vbox4 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox4);
    gtk_container_add (GTK_CONTAINER (alignment), vbox4);
    gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8);

    appGUI->cnt->format_csv_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, "CSV");
    gtk_widget_show (appGUI->cnt->format_csv_radiobutton);
    g_signal_connect (G_OBJECT (appGUI->cnt->format_csv_radiobutton), "clicked",
                      G_CALLBACK(format_changed_cb), appGUI);
    GTK_WIDGET_UNSET_FLAGS(appGUI->cnt->format_csv_radiobutton, GTK_CAN_FOCUS);
    gtk_box_pack_start (GTK_BOX (vbox4), appGUI->cnt->format_csv_radiobutton, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (appGUI->cnt->format_csv_radiobutton), format_radiobutton_group);
    format_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (appGUI->cnt->format_csv_radiobutton));

    format_xhtml_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, "XHTML");
    gtk_widget_show (format_xhtml_radiobutton);
    g_signal_connect (G_OBJECT (format_xhtml_radiobutton), "clicked",
                      G_CALLBACK(format_changed_cb), appGUI);
    GTK_WIDGET_UNSET_FLAGS(format_xhtml_radiobutton, GTK_CAN_FOCUS);
    gtk_box_pack_start (GTK_BOX (vbox4), format_xhtml_radiobutton, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (format_xhtml_radiobutton), format_radiobutton_group);
    format_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (format_xhtml_radiobutton));

    if (config.export_format) {
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(format_xhtml_radiobutton), TRUE);
    }

    sprintf(tmpbuf, "<b>%s:</b>", _("Output format"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    frame = gtk_frame_new (NULL);
    gtk_widget_show (frame);
    gtk_box_pack_start (GTK_BOX (vbox3), frame, FALSE, FALSE, 0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
    gtk_widget_show (alignment);
    gtk_container_add (GTK_CONTAINER (frame), alignment);
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

    vbox4 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox4);
    gtk_container_add (GTK_CONTAINER (alignment), vbox4);
    gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8);

    sprintf(tmpbuf, "<b>%s:</b>", _("Options"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    sprintf(tmpbuf, "%s", _("Add header"));
    appGUI->cnt->first_row_header_check_button = gtk_check_button_new_with_mnemonic (tmpbuf);
    gtk_widget_show (appGUI->cnt->first_row_header_check_button);
    gtk_box_pack_start (GTK_BOX (vbox4), appGUI->cnt->first_row_header_check_button, TRUE, TRUE, 0);
    GTK_WIDGET_UNSET_FLAGS(appGUI->cnt->first_row_header_check_button, GTK_CAN_FOCUS);
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(appGUI->cnt->first_row_header_check_button), TRUE);

    vseparator = gtk_vseparator_new ();
    gtk_widget_show (vseparator);
    gtk_box_pack_start (GTK_BOX (hbox2), vseparator, FALSE, TRUE, 4);

    vbox5 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox5);
    gtk_box_pack_start (GTK_BOX (hbox2), vbox5, TRUE, TRUE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox4), 8);

    frame = gtk_frame_new (NULL);
    gtk_widget_show (frame);
    gtk_box_pack_start (GTK_BOX (vbox5), frame, TRUE, TRUE, 0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
    gtk_widget_show (alignment);
    gtk_container_add (GTK_CONTAINER (frame), alignment);
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_show (scrolledwindow);
    gtk_container_add (GTK_CONTAINER (alignment), scrolledwindow);
    gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 8);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    viewport = gtk_viewport_new (NULL, NULL);
    gtk_widget_show (viewport);
    gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport);

    fields_table = gtk_table_new (CONTACTS_NUM_COLUMNS, 1, FALSE);
    gtk_widget_show (fields_table);
    gtk_container_add (GTK_CONTAINER (viewport), fields_table);

    sprintf(tmpbuf, "<b>%s:</b>", _("Fields to export"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    frame = gtk_frame_new (NULL);
    gtk_widget_show (frame);
    gtk_box_pack_start (GTK_BOX (vbox5), frame, FALSE, TRUE, 0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
    gtk_widget_show (alignment);
    gtk_container_add (GTK_CONTAINER (frame), alignment);
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

    hbuttonbox_s = gtk_hbutton_box_new ();
    gtk_widget_show (hbuttonbox_s);
    gtk_box_pack_start (GTK_BOX (vbox5), hbuttonbox_s, FALSE, TRUE, 0);
    gtk_box_set_spacing (GTK_BOX (hbuttonbox_s), 4);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox_s), GTK_BUTTONBOX_END);

    select_all_button = gtk_button_new_with_label (_("All"));
    GTK_WIDGET_UNSET_FLAGS(select_all_button, GTK_CAN_FOCUS);
    gtk_widget_show (select_all_button);
    gtk_container_add (GTK_CONTAINER (hbuttonbox_s), select_all_button);
    msg_select[0].appGUI = appGUI;
    msg_select[0].data = (gpointer) SELECT_ALL;
    g_signal_connect (G_OBJECT (select_all_button), "clicked",
                        G_CALLBACK (select_action_cb), &msg_select[0]);

    select_none_button = gtk_button_new_with_label (_("None"));
    GTK_WIDGET_UNSET_FLAGS(select_none_button, GTK_CAN_FOCUS);
    gtk_widget_show (select_none_button);
    gtk_container_add (GTK_CONTAINER (hbuttonbox_s), select_none_button);
    msg_select[1].appGUI = appGUI;
    msg_select[1].data = (gpointer) SELECT_NONE;
    g_signal_connect (G_OBJECT (select_none_button), "clicked",
                        G_CALLBACK (select_action_cb), &msg_select[1]);

    invert_selection_button = gtk_button_new_with_label (_("Invert"));
    GTK_WIDGET_UNSET_FLAGS(invert_selection_button, GTK_CAN_FOCUS);
    gtk_widget_show (select_none_button);
    gtk_widget_show (invert_selection_button);
    gtk_container_add (GTK_CONTAINER (hbuttonbox_s), invert_selection_button);
    msg_select[2].appGUI = appGUI;
    msg_select[2].data = (gpointer) SELECT_INVERT;
    g_signal_connect (G_OBJECT (invert_selection_button), "clicked",
                        G_CALLBACK (select_action_cb), &msg_select[2]);

    sprintf(tmpbuf, "<b>%s:</b>", _("Select fields"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    frame = gtk_frame_new (NULL);
    gtk_widget_show (frame);
    gtk_box_pack_start (GTK_BOX (vbox1), frame, FALSE, TRUE, 0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

    alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
    gtk_widget_show (alignment);
    gtk_container_add (GTK_CONTAINER (frame), alignment);
    gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);

    hbox3 = gtk_hbox_new (FALSE, 8);
    gtk_widget_show (hbox3);
    gtk_container_add (GTK_CONTAINER (alignment), hbox3);

    appGUI->cnt->output_file_entry = gtk_entry_new ();
    gtk_widget_show (appGUI->cnt->output_file_entry);
    gtk_box_pack_start (GTK_BOX (hbox3), appGUI->cnt->output_file_entry, TRUE, TRUE, 0);
    GTK_WIDGET_UNSET_FLAGS(appGUI->cnt->output_file_entry, GTK_CAN_FOCUS);
    gtk_editable_set_editable (GTK_EDITABLE(appGUI->cnt->output_file_entry), FALSE);

    for(i=0; i < CONTACTS_NUM_COLUMNS; i++) {

        if (i != COLUMN_PHOTO && i != COLUMN_ID) {

            appGUI->cnt->check_buttons[i] = gtk_check_button_new_with_mnemonic (appGUI->cnt->contact_fields_tags_name[i*2]);

            gtk_widget_show (appGUI->cnt->check_buttons[i]);
            msg_export_field[i].appGUI = appGUI;
            msg_export_field[i].data = (gpointer) i;
            g_signal_connect (G_OBJECT (appGUI->cnt->check_buttons[i]), "toggled",
                              G_CALLBACK (export_field_selected_cb), &msg_export_field[i]);
            GTK_WIDGET_UNSET_FLAGS(appGUI->cnt->check_buttons[i], GTK_CAN_FOCUS);
            gtk_table_attach (GTK_TABLE (fields_table), appGUI->cnt->check_buttons[i], 0, 1, i, i+1,
                              (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                              (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

            if(config.export_fields[i] == '+') {
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(appGUI->cnt->check_buttons[i]), TRUE);
            }
        }
    }

    if (config.default_stock_icons) {
        browse_dir_button = utl_gui_stock_button (GTK_STOCK_DIRECTORY, FALSE);
    } else {
        browse_dir_button = gtk_button_new_from_stock (OSMO_STOCK_BUTTON_OPEN);
    }
    gtk_widget_show (browse_dir_button);
    GTK_WIDGET_UNSET_FLAGS(browse_dir_button, GTK_CAN_FOCUS);
    g_signal_connect(browse_dir_button, "clicked", G_CALLBACK(browse_dir_cb), appGUI);
    gtk_box_pack_start (GTK_BOX (hbox3), browse_dir_button, FALSE, FALSE, 0);

    sprintf(tmpbuf, "<b>%s:</b>", _("Output filename"));
    label = gtk_label_new (tmpbuf);
    gtk_widget_show (label);
    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
    gtk_label_set_use_markup (GTK_LABEL (label), TRUE);

    hseparator = gtk_hseparator_new ();
    gtk_widget_show (hseparator);
    gtk_box_pack_start (GTK_BOX (vbox1), hseparator, FALSE, TRUE, 4);

    hbuttonbox = gtk_hbutton_box_new ();
    gtk_widget_show (hbuttonbox);
    gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox, FALSE, TRUE, 0);
    gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);
    gtk_box_set_spacing (GTK_BOX (hbuttonbox), 8);

    if (config.default_stock_icons) {
	    cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
    } else {
        cancel_button = gtk_button_new_from_stock (OSMO_STOCK_BUTTON_CANCEL);
    }
    gtk_widget_show (cancel_button);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), cancel_button);
    GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
    g_signal_connect(cancel_button, "clicked", G_CALLBACK(button_export_window_close_cb), appGUI);

    appGUI->cnt->export_button = gtk_button_new_from_stock (OSMO_STOCK_BUTTON_CONTACTS_EXPORT);
    gtk_widget_show (appGUI->cnt->export_button);
    gtk_container_add (GTK_CONTAINER (hbuttonbox), appGUI->cnt->export_button);
    GTK_WIDGET_SET_FLAGS (appGUI->cnt->export_button, GTK_CAN_DEFAULT);
    g_signal_connect(appGUI->cnt->export_button, "clicked", G_CALLBACK(export_cb), appGUI);
    gtk_widget_set_sensitive(appGUI->cnt->export_button, FALSE);

    gtk_widget_show(appGUI->cnt->export_window);

}
Ejemplo n.º 20
0
GtkWidget*
create_connection_setup (void)
{
  GtkWidget *connection_setup;
  GtkWidget *dialog_vbox1;
  GtkWidget *fixed1;
  GtkWidget *nom_joueur_entry;
  GtkWidget *server_hbox;
  GtkWidget *port_server_label;
  GtkWidget *port_server_entry;
  GtkWidget *nom_joueur_label;
  GtkWidget *client_vbox;
  GtkWidget *client_hbox1;
  GtkWidget *ip_client_label;
  GtkWidget *client_ip_entry;
  GtkWidget *client_hbox2;
  GtkWidget *port_client_label;
  GtkWidget *port_client_entry;
  GtkWidget *radio_im_server;
  GSList *radio_im_server_group = NULL;
  GtkWidget *radio_im_not_server;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *alignment2;
  GtkWidget *hbox2;
  GtkWidget *image56;
  GtkWidget *label5;
  GtkWidget *okbutton1;
  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image55;
  GtkWidget *label4;

  connection_setup = gtk_dialog_new ();
  gtk_widget_set_size_request (connection_setup, 276, 301);
  gtk_window_set_title (GTK_WINDOW (connection_setup), "Partie R\303\251seau");
  gtk_window_set_resizable (GTK_WINDOW (connection_setup), FALSE);
  gtk_window_set_destroy_with_parent (GTK_WINDOW (connection_setup), TRUE);
  //gtk_window_set_icon_name (GTK_WINDOW (connection_setup), "gtk-dialog-info");
  gtk_window_set_type_hint (GTK_WINDOW (connection_setup), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  fixed1 = gtk_fixed_new ();
  gtk_widget_show (fixed1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), fixed1, TRUE, TRUE, 0);

  nom_joueur_entry = gtk_entry_new ();
  gtk_widget_show (nom_joueur_entry);
  gtk_fixed_put (GTK_FIXED (fixed1), nom_joueur_entry, 72, 49);
  gtk_widget_set_size_request (nom_joueur_entry, 158, 26);
  gtk_entry_set_text (GTK_ENTRY (nom_joueur_entry), "Bob");

  server_hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (server_hbox);
  gtk_fixed_put (GTK_FIXED (fixed1), server_hbox, 37, 122);
  gtk_widget_set_size_request (server_hbox, 32, 16);

  port_server_label = gtk_label_new ("Port");
  gtk_widget_show (port_server_label);
  gtk_box_pack_start (GTK_BOX (server_hbox), port_server_label, FALSE, FALSE, 0);
  gtk_widget_set_size_request (port_server_label, 36, 18);

  port_server_entry = gtk_entry_new ();
  gtk_widget_show (port_server_entry);
  gtk_box_pack_start (GTK_BOX (server_hbox), port_server_entry, FALSE, FALSE, 0);
  gtk_widget_set_size_request (port_server_entry, 158, 26);
  gtk_entry_set_text (GTK_ENTRY (port_server_entry), "5010");

  nom_joueur_label = gtk_label_new ("<b>Mon nom de joueur :</b>");
  gtk_widget_show (nom_joueur_label);
  gtk_fixed_put (GTK_FIXED (fixed1), nom_joueur_label, 16, 16);
  gtk_widget_set_size_request (nom_joueur_label, 152, 26);
  gtk_label_set_use_markup (GTK_LABEL (nom_joueur_label), TRUE);

  client_vbox = gtk_vbox_new (FALSE, 29);
  gtk_widget_show (client_vbox);
  gtk_fixed_put (GTK_FIXED (fixed1), client_vbox, 36, 197);
  gtk_widget_set_size_request (client_vbox, 16, 32);
  gtk_widget_set_sensitive (client_vbox, FALSE);

  client_hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (client_hbox1);
  gtk_box_pack_start (GTK_BOX (client_vbox), client_hbox1, TRUE, FALSE, 0);
  gtk_widget_set_size_request (client_hbox1, 32, 16);

  ip_client_label = gtk_label_new ("IP");
  gtk_widget_show (ip_client_label);
  gtk_box_pack_start (GTK_BOX (client_hbox1), ip_client_label, FALSE, FALSE, 0);
  gtk_widget_set_size_request (ip_client_label, 36, 18);

  client_ip_entry = gtk_entry_new ();
  gtk_widget_show (client_ip_entry);
  gtk_box_pack_start (GTK_BOX (client_hbox1), client_ip_entry, FALSE, FALSE, 0);
  gtk_widget_set_size_request (client_ip_entry, 158, 26);

  client_hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (client_hbox2);
  gtk_box_pack_start (GTK_BOX (client_vbox), client_hbox2, TRUE, FALSE, 0);
  gtk_widget_set_size_request (client_hbox2, 32, 16);

  port_client_label = gtk_label_new ("Port");
  gtk_widget_show (port_client_label);
  gtk_box_pack_start (GTK_BOX (client_hbox2), port_client_label, FALSE, FALSE, 0);
  gtk_widget_set_size_request (port_client_label, 36, 18);

  port_client_entry = gtk_entry_new ();
  gtk_widget_show (port_client_entry);
  gtk_box_pack_start (GTK_BOX (client_hbox2), port_client_entry, FALSE, FALSE, 0);
  gtk_widget_set_size_request (port_client_entry, 158, 26);
  gtk_entry_set_text (GTK_ENTRY (port_client_entry), "5010");

  radio_im_server = gtk_radio_button_new_with_mnemonic (NULL, "J'h\303\251berge la partie");
  gtk_widget_show (radio_im_server);
  gtk_fixed_put (GTK_FIXED (fixed1), radio_im_server, 32, 89);
  gtk_widget_set_size_request (radio_im_server, 152, 22);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_im_server), radio_im_server_group);
  radio_im_server_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_im_server));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_im_server), TRUE);

  radio_im_not_server = gtk_radio_button_new_with_mnemonic (NULL, "Je me connecte chez quelqu'un");
  gtk_widget_show (radio_im_not_server);
  gtk_fixed_put (GTK_FIXED (fixed1), radio_im_not_server, 32, 160);
  gtk_widget_set_size_request (radio_im_not_server, 240, 22);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_im_not_server), radio_im_server_group);
  radio_im_server_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_im_not_server));

  dialog_action_area1 = GTK_DIALOG (connection_setup)->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 ();
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (connection_setup), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

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

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

  image56 = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image56);
  gtk_box_pack_start (GTK_BOX (hbox2), image56, FALSE, FALSE, 0);

  label5 = gtk_label_new_with_mnemonic ("Annuler");
  gtk_widget_show (label5);
  gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0);

  okbutton1 = gtk_button_new ();
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (connection_setup), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (okbutton1), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image55 = gtk_image_new_from_stock ("gtk-goto-last", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image55);
  gtk_box_pack_start (GTK_BOX (hbox1), image55, FALSE, FALSE, 0);

  label4 = gtk_label_new_with_mnemonic ("C'est parti !");
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (hbox1), label4, FALSE, FALSE, 0);

  g_signal_connect_swapped ((gpointer) radio_im_server, "toggled",
                            G_CALLBACK (on_radio_im_server_toggled),
                            GTK_OBJECT (client_vbox));
  g_signal_connect_swapped ((gpointer) radio_im_not_server, "toggled",
                            G_CALLBACK (on_radio_im_not_server_toggled),
                            GTK_OBJECT (server_hbox));

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (connection_setup, connection_setup, "connection_setup");
  GLADE_HOOKUP_OBJECT_NO_REF (connection_setup, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (connection_setup, fixed1, "fixed1");
  GLADE_HOOKUP_OBJECT (connection_setup, nom_joueur_entry, "nom_joueur_entry");
  GLADE_HOOKUP_OBJECT (connection_setup, server_hbox, "server_hbox");
  GLADE_HOOKUP_OBJECT (connection_setup, port_server_label, "port_server_label");
  GLADE_HOOKUP_OBJECT (connection_setup, port_server_entry, "port_server_entry");
  GLADE_HOOKUP_OBJECT (connection_setup, nom_joueur_label, "nom_joueur_label");
  GLADE_HOOKUP_OBJECT (connection_setup, client_vbox, "client_vbox");
  GLADE_HOOKUP_OBJECT (connection_setup, client_hbox1, "client_hbox1");
  GLADE_HOOKUP_OBJECT (connection_setup, ip_client_label, "ip_client_label");
  GLADE_HOOKUP_OBJECT (connection_setup, client_ip_entry, "client_ip_entry");
  GLADE_HOOKUP_OBJECT (connection_setup, client_hbox2, "client_hbox2");
  GLADE_HOOKUP_OBJECT (connection_setup, port_client_label, "port_client_label");
  GLADE_HOOKUP_OBJECT (connection_setup, port_client_entry, "port_client_entry");
  GLADE_HOOKUP_OBJECT (connection_setup, radio_im_server, "radio_im_server");
  GLADE_HOOKUP_OBJECT (connection_setup, radio_im_not_server, "radio_im_not_server");
  GLADE_HOOKUP_OBJECT_NO_REF (connection_setup, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (connection_setup, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (connection_setup, alignment2, "alignment2");
  GLADE_HOOKUP_OBJECT (connection_setup, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (connection_setup, image56, "image56");
  GLADE_HOOKUP_OBJECT (connection_setup, label5, "label5");
  GLADE_HOOKUP_OBJECT (connection_setup, okbutton1, "okbutton1");
  GLADE_HOOKUP_OBJECT (connection_setup, alignment1, "alignment1");
  GLADE_HOOKUP_OBJECT (connection_setup, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (connection_setup, image55, "image55");
  GLADE_HOOKUP_OBJECT (connection_setup, label4, "label4");

  gtk_widget_grab_focus (okbutton1);
  gtk_widget_grab_default (okbutton1);
  return connection_setup;
}
static void
run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
{
  GError *error;
  gchar *name, *regex;
  const gchar *title;
  GtkWidget *dialog, *entry_name, *entry_regex, *radio_color;
  GtkWidget *radio_visible, *check_foreground, *check_background;
  GtkWidget *color_foreground, *color_background, *vbox_color;
  gboolean foreground_set, background_set, invisible;
  GtkTextTag *tag;
  GtkBuilder* builder;

  builder = manager->priv->builder;

  error = NULL;
  name = NULL;
  
  gtk_builder_add_from_file (builder, UI_FILE, &error);

  if (error) {
    g_warning ("Could not load filter ui: %s", error->message);
    g_error_free (error);
    return;
  }

  title = (filter != NULL ? _("Edit filter") : _("Add new filter"));

  dialog = GTK_WIDGET (gtk_builder_get_object (builder,
                                               "dialog_filter"));

  entry_name = GTK_WIDGET (gtk_builder_get_object (builder,
                                                   "entry_name"));
  entry_regex = GTK_WIDGET (gtk_builder_get_object (builder,
                                                    "entry_regex"));
  radio_color = GTK_WIDGET (gtk_builder_get_object (builder,
                                                    "radio_color"));
  radio_visible = GTK_WIDGET (gtk_builder_get_object (builder,
                                                      "radio_visible"));

  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_color),
                              gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_visible)));

  check_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
                                                         "check_foreground"));
  check_background = GTK_WIDGET (gtk_builder_get_object (builder,
                                                         "check_background"));
  color_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
                                                         "color_foreground"));
  color_background = GTK_WIDGET (gtk_builder_get_object (builder,
                                                         "color_background"));
  g_signal_connect (check_foreground, "toggled", G_CALLBACK (on_check_toggled),
                    color_foreground);
  g_signal_connect (check_background, "toggled", G_CALLBACK (on_check_toggled),
                    color_background);

  on_check_toggled (GTK_TOGGLE_BUTTON (check_foreground),
                    color_foreground);
  on_check_toggled (GTK_TOGGLE_BUTTON (check_background),
                    color_background);

  vbox_color = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_color"));
  g_signal_connect (radio_color, "toggled", G_CALLBACK (on_check_toggled),
                    vbox_color);
  on_check_toggled (GTK_TOGGLE_BUTTON (radio_color),
                    vbox_color);

  if (filter) {
    g_object_get (filter,
                  "name", &name,
                  "regex", &regex,
                  "texttag", &tag,
                  NULL);
    g_object_get (tag,
                  "foreground-set", &foreground_set,
                  "paragraph-background-set", &background_set,
                  "invisible", &invisible, NULL);
    gtk_entry_set_text (GTK_ENTRY(entry_name), name);
    gtk_entry_set_text (GTK_ENTRY(entry_regex), regex);

    if (foreground_set) {
      GdkColor *foreground;

      g_object_get (tag, "foreground-gdk", &foreground, NULL);
      gtk_color_button_set_color (GTK_COLOR_BUTTON (color_foreground),
                                  foreground);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_foreground),
                                    TRUE);

      gdk_color_free (foreground);
    }

    if (background_set) {
      GdkColor *background;

      g_object_get (tag, "paragraph-background-gdk", &background, NULL);
      gtk_color_button_set_color (GTK_COLOR_BUTTON (color_background),
                                  background);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_background),
                                    TRUE);

      gdk_color_free (background);
    }

    if (background_set || foreground_set) {
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_color), TRUE);
    } else if (invisible) {
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_visible), TRUE);
    }

    g_free (regex);
    g_object_unref (tag);
  }

  g_object_set_data_full (G_OBJECT (manager), "old_name", name, g_free);

  g_signal_connect (G_OBJECT (dialog), "response",
                    G_CALLBACK (on_dialog_add_edit_reponse), manager);
  gtk_window_set_transient_for (GTK_WINDOW (dialog),
                                GTK_WINDOW (manager));
  gtk_window_set_modal (GTK_WINDOW (dialog),
                        TRUE);

  gtk_widget_show (GTK_WIDGET (dialog));
}
Ejemplo n.º 22
0
GotoReferenceDialog::GotoReferenceDialog(unsigned int currentbook, unsigned int currentchapter, const ustring & currentverse)
{
  // Init variables
  extern Settings *settings;
  ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
  language = projectconfig->language_get();
  newreference = false;
  oldbook = currentbook;
  oldchapter = currentchapter;
  oldverse = currentverse;
  go_back = false;
  go_forward = false;

  Shortcuts shortcuts(0);

  gtkbuilder = gtk_builder_new ();
  gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.gotoreferencedialog.xml").c_str(), NULL);

  dialog = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "dialog"));
  g_signal_connect((gpointer) dialog, "key_press_event", G_CALLBACK(on_key_press_event), gpointer(this));

  notebook = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "notebook"));

  // Enter current reference into the free entry, and select it, so user can use that.
  entry_free = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "entry_free"));
  gtk_widget_grab_focus(entry_free);
  ustring ref = books_id_to_name(language, currentbook) + " " + convert_to_string(currentchapter) + ":" + currentverse;
  gtk_entry_set_text(GTK_ENTRY(entry_free), ref.c_str());
  gtk_editable_select_region(GTK_EDITABLE(entry_free), 0, -1);

  // Completion for the reference entry.
  completion_setup(entry_free, cpGoto);

  // Signals entry.
  g_signal_connect((gpointer) entry_free, "activate", G_CALLBACK(on_entry_free_activate), gpointer(this));
  
  // Aided entry widgets.
  treeview_book = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_book"));
  treeview_chapter = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_chapter"));
  treeview_verse = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "treeview_verse"));
  
  // Connect to the signals of the treeviews.
  g_signal_connect_after((gpointer) treeview_book, "move_cursor", G_CALLBACK(on_treeview_book_move_cursor), gpointer(this));
  g_signal_connect_after((gpointer) treeview_book, "row_activated", G_CALLBACK(on_treeview_book_row_activated), gpointer(this));
  g_signal_connect_after((gpointer) treeview_chapter, "move_cursor", G_CALLBACK(on_treeview_chapter_move_cursor), gpointer(this));
  g_signal_connect_after((gpointer) treeview_chapter, "row_activated", G_CALLBACK(on_treeview_chapter_row_activated), gpointer(this));
  g_signal_connect_after((gpointer) treeview_verse, "move_cursor", G_CALLBACK(on_treeview_verse_move_cursor), gpointer(this));
  g_signal_connect_after((gpointer) treeview_verse, "row_activated", G_CALLBACK(on_treeview_verse_row_activated), gpointer(this));

  // Create stores and fill the book store.
  store_book = gtk_list_store_new(1, G_TYPE_STRING);
  store_chapter = gtk_list_store_new(1, G_TYPE_STRING);
  store_verse = gtk_list_store_new(1, G_TYPE_STRING);
  vector < unsigned int >ibooks = project_get_books(settings->genconfig.project_get());
  vector < ustring > ubooks;
  for (unsigned int i = 0; i < ibooks.size(); i++)
    ubooks.push_back(books_id_to_name(language, ibooks[i]));
  listview_set_strings(treeview_book, store_book, ubooks);

  // Set the stores as models for the treeviews.
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_book), GTK_TREE_MODEL(store_book));
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_chapter), GTK_TREE_MODEL(store_chapter));
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_verse), GTK_TREE_MODEL(store_verse));

  // Unreference the stores once, so they get destroyed with the treeview.
  g_object_unref(store_book);
  g_object_unref(store_chapter);
  g_object_unref(store_verse);

  // Text cell renderer.
  GtkCellRenderer *renderer;
  renderer = gtk_cell_renderer_text_new();

  // Columns.
  GtkTreeViewColumn *column_book;
  column_book = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_book), column_book);
  GtkTreeViewColumn *column_chapter;
  column_chapter = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_chapter), column_chapter);
  GtkTreeViewColumn *column_verse;
  column_verse = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(treeview_verse), column_verse);

  // Set up the selection for each of the tree views.
  GtkTreeSelection *select_book;
  select_book = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_book));
  gtk_tree_selection_set_mode(select_book, GTK_SELECTION_SINGLE);
  GtkTreeSelection *select_chapter;
  select_chapter = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_chapter));
  gtk_tree_selection_set_mode(select_chapter, GTK_SELECTION_SINGLE);
  GtkTreeSelection *select_verse;
  select_verse = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview_verse));
  gtk_tree_selection_set_mode(select_verse, GTK_SELECTION_SINGLE);

  // History back.
  radiobutton_back = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_back"));
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_back), true);

  // History forward.
  radiobutton_forward = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_forward"));
 
  // Link history button.
  GSList *history_button_group = NULL;
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_back), history_button_group);
  history_button_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_back));
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_forward), history_button_group);
  history_button_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_forward));

  // Dialog action area.
  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, &shortcuts, NULL);
  cancelbutton = indialoghelp->cancelbutton;
  okbutton = indialoghelp->okbutton;
  gtk_widget_grab_default(okbutton);
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));
}
Ejemplo n.º 23
0
RevertDialog::RevertDialog(Reference * reference)
{
  // Save variables.
  extern Settings *settings;
  project = settings->genconfig.project_get();
  ProjectConfiguration *projectconfig = settings->projectconfig(project);
  language = projectconfig->language_get();
  reference_chapter = reference->chapter_get();
  revisionloaded = false;
  branch = 0;

  // Build dialog.
  Shortcuts shortcuts(0);

  revertdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(revertdialog), _("Revert"));
  gtk_window_set_position(GTK_WINDOW(revertdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_type_hint(GTK_WINDOW(revertdialog), GDK_WINDOW_TYPE_HINT_DIALOG);

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

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

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

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

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

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

  labelbook = gtk_label_new(_("Book"));
  gtk_widget_show(labelbook);
  gtk_table_attach(GTK_TABLE(table1), labelbook, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(labelbook), 0, 0.5);

  shortcuts.label(labelbook);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelbook), comboboxbook);

  labelchapter = gtk_label_new(_("Chapter"));
  gtk_widget_show(labelchapter);
  gtk_table_attach(GTK_TABLE(table1), labelchapter, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(labelchapter), 0, 0.5);

  shortcuts.label(labelchapter);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelchapter), comboboxchapter);

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

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

  shortcuts.label(labelrevisions);

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

  treeviewrevisions = gtk_tree_view_new();
  gtk_widget_show(treeviewrevisions);
  gtk_container_add(GTK_CONTAINER(scrolledwindowrevisions), treeviewrevisions);
  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeviewrevisions), FALSE);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelrevisions), treeviewrevisions);

  // Create treeview related stuff.
  store = gtk_list_store_new(1, G_TYPE_STRING);
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeviewrevisions), GTK_TREE_MODEL(store));
  g_object_unref(store);
  GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
  column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(treeviewrevisions), column);
  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeviewrevisions));
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

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

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

  GSList *radiobutton_current_group = NULL;

  radiobutton_current = gtk_radio_button_new_with_mnemonic (NULL, _("View current version"));
  gtk_widget_show (radiobutton_current);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_current, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_current), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_current));

  shortcuts.button(radiobutton_current);

  radiobutton_previous = gtk_radio_button_new_with_mnemonic (NULL, _("View previous revision"));
  gtk_widget_show (radiobutton_previous);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_previous, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_previous), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_previous));

  shortcuts.button(radiobutton_previous);

  radiobutton_changes = gtk_radio_button_new_with_mnemonic (NULL, _("View changes if reverting to previous revision"));
  gtk_widget_show (radiobutton_changes);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_changes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_changes), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_changes));

  shortcuts.button(radiobutton_changes);
 
  changes_gui = new DisplayChangesGui (vbox2);

  gtk_widget_set_size_request(changes_gui->textview, 450, 500);

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

  new InDialogHelp(revertdialog, NULL, &shortcuts, "edit/revert");

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

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

  shortcuts.stockbutton(cancelbutton1);
  shortcuts.stockbutton(okbutton1);
  shortcuts.process();

  g_signal_connect((gpointer) comboboxbook, "changed", G_CALLBACK(on_comboboxbook_changed), gpointer(this));
  g_signal_connect((gpointer) comboboxchapter, "changed", G_CALLBACK(on_comboboxchapter_changed), gpointer(this));
  g_signal_connect((gpointer) treeviewrevisions, "row_activated", G_CALLBACK(on_treeviewrevisions_row_activated), gpointer(this));
  g_signal_connect((gpointer) okbutton1, "clicked", G_CALLBACK(on_okbutton1_clicked), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_current, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_previous, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_changes, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));

  gtk_widget_grab_focus(okbutton1);
  gtk_widget_grab_default(okbutton1);

  // Load books. This also loads the chapters through the callback.
  vector < unsigned int >books = project_get_books(project);
  vector < ustring > localbooks;
  for (unsigned int i = 0; i < books.size(); i++) {
    localbooks.push_back(books_id_to_name(language, books[i]));
  }
  combobox_set_strings(comboboxbook, localbooks);
  combobox_set_string(comboboxbook, books_id_to_name(language, reference->book_get()));
  
  // By default view changes.
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_changes), true);
}
Ejemplo n.º 24
0
GtkWidget*
create_dialogAudio (void)
{
  GtkWidget *dialogAudio;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox3;
  GtkWidget *frame3;
  GtkWidget *vbox6;
  GtkWidget *checkbuttonNormalize;
  GtkWidget *checkbuttonDRC;
  GtkWidget *hbox3;
  GtkWidget *checkbuttonTimeShift;
  GtkWidget *entryTimeshift;
  GtkWidget *label5;
  GtkWidget *frame1;
  GtkWidget *vbox4;
  GtkWidget *radiobuttonNone;
  GSList *radiobuttonNone_group = NULL;
  GtkWidget *radiobutton2;
  GtkWidget *hbox2;
  GtkWidget *radiobuttonSox;
  GtkWidget *entryFrequency;
  GtkWidget *label3;
  GtkWidget *frame2;
  GtkWidget *vbox5;
  GtkWidget *radiobutton_fpsnone;
  GSList *radiobutton_fpsnone_group = NULL;
  GtkWidget *radiobutton_fpsfilm;
  GtkWidget *radiobutton_fpsPAL;
  GtkWidget *label4;
  GtkWidget *frame4;
  GtkWidget *vbox7;
  GtkWidget *radiobutton_2to2;
  GSList *radiobutton_2to2_group = NULL;
  GtkWidget *radiobutton2to1;
  GtkWidget *radiobutton1to2;
  GtkWidget *label6;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialogAudio = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialogAudio), _("Audio Processing"));

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

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

  frame3 = gtk_frame_new (NULL);
  gtk_widget_show (frame3);
  gtk_box_pack_start (GTK_BOX (vbox3), frame3, FALSE, FALSE, 0);

  vbox6 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox6);
  gtk_container_add (GTK_CONTAINER (frame3), vbox6);

  checkbuttonNormalize = gtk_check_button_new_with_mnemonic (_("Normalize"));
  gtk_widget_show (checkbuttonNormalize);
  gtk_box_pack_start (GTK_BOX (vbox6), checkbuttonNormalize, FALSE, FALSE, 0);

  checkbuttonDRC = gtk_check_button_new_with_mnemonic (_("DRC"));
  gtk_widget_show (checkbuttonDRC);
  gtk_box_pack_start (GTK_BOX (vbox6), checkbuttonDRC, FALSE, FALSE, 0);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_box_pack_start (GTK_BOX (vbox6), hbox3, TRUE, TRUE, 0);

  checkbuttonTimeShift = gtk_check_button_new_with_mnemonic (_("Timeshift"));
  gtk_widget_show (checkbuttonTimeShift);
  gtk_box_pack_start (GTK_BOX (hbox3), checkbuttonTimeShift, FALSE, FALSE, 0);

  entryTimeshift = gtk_entry_new ();
  gtk_widget_show (entryTimeshift);
  gtk_box_pack_start (GTK_BOX (hbox3), entryTimeshift, TRUE, TRUE, 0);
  gtk_entry_set_max_length (GTK_ENTRY (entryTimeshift), 5);

  label5 = gtk_label_new (_("<b>Misc</b>"));
  gtk_widget_show (label5);
  gtk_frame_set_label_widget (GTK_FRAME (frame3), label5);
  gtk_label_set_use_markup (GTK_LABEL (label5), TRUE);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (vbox3), frame1, FALSE, FALSE, 0);

  vbox4 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox4);
  gtk_container_add (GTK_CONTAINER (frame1), vbox4);

  radiobuttonNone = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
  gtk_widget_show (radiobuttonNone);
  gtk_box_pack_start (GTK_BOX (vbox4), radiobuttonNone, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobuttonNone), radiobuttonNone_group);
  radiobuttonNone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobuttonNone));

  radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, _("48 to 44.1 khz"));
  gtk_widget_show (radiobutton2);
  gtk_box_pack_start (GTK_BOX (vbox4), radiobutton2, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobuttonNone_group);
  radiobuttonNone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2));

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

  radiobuttonSox = gtk_radio_button_new_with_mnemonic (NULL, _("Resample to hz"));
  gtk_widget_show (radiobuttonSox);
  gtk_box_pack_start (GTK_BOX (hbox2), radiobuttonSox, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobuttonSox), radiobuttonNone_group);
  radiobuttonNone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobuttonSox));

  entryFrequency = gtk_entry_new ();
  gtk_widget_show (entryFrequency);
  gtk_box_pack_start (GTK_BOX (hbox2), entryFrequency, TRUE, TRUE, 0);

  label3 = gtk_label_new (_("<b>Resampling</b>"));
  gtk_widget_show (label3);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label3);
  gtk_label_set_use_markup (GTK_LABEL (label3), TRUE);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox3), frame2, TRUE, TRUE, 0);

  vbox5 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox5);
  gtk_container_add (GTK_CONTAINER (frame2), vbox5);

  radiobutton_fpsnone = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
  gtk_widget_show (radiobutton_fpsnone);
  gtk_box_pack_start (GTK_BOX (vbox5), radiobutton_fpsnone, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_fpsnone), radiobutton_fpsnone_group);
  radiobutton_fpsnone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_fpsnone));

  radiobutton_fpsfilm = gtk_radio_button_new_with_mnemonic (NULL, _("Film -> PAL"));
  gtk_widget_show (radiobutton_fpsfilm);
  gtk_box_pack_start (GTK_BOX (vbox5), radiobutton_fpsfilm, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_fpsfilm), radiobutton_fpsnone_group);
  radiobutton_fpsnone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_fpsfilm));

  radiobutton_fpsPAL = gtk_radio_button_new_with_mnemonic (NULL, _("PAL->Film"));
  gtk_widget_show (radiobutton_fpsPAL);
  gtk_box_pack_start (GTK_BOX (vbox5), radiobutton_fpsPAL, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_fpsPAL), radiobutton_fpsnone_group);
  radiobutton_fpsnone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_fpsPAL));

  label4 = gtk_label_new (_("<b>Fps convert</b>"));
  gtk_widget_show (label4);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label4);
  gtk_label_set_use_markup (GTK_LABEL (label4), TRUE);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);

  frame4 = gtk_frame_new (NULL);
  gtk_widget_show (frame4);
  gtk_box_pack_start (GTK_BOX (vbox3), frame4, TRUE, TRUE, 0);

  vbox7 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox7);
  gtk_container_add (GTK_CONTAINER (frame4), vbox7);

  radiobutton_2to2 = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
  gtk_widget_show (radiobutton_2to2);
  gtk_box_pack_start (GTK_BOX (vbox7), radiobutton_2to2, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_2to2), radiobutton_2to2_group);
  radiobutton_2to2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_2to2));

  radiobutton2to1 = gtk_radio_button_new_with_mnemonic (NULL, _("Stereo to Mono"));
  gtk_widget_show (radiobutton2to1);
  gtk_box_pack_start (GTK_BOX (vbox7), radiobutton2to1, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2to1), radiobutton_2to2_group);
  radiobutton_2to2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2to1));

  radiobutton1to2 = gtk_radio_button_new_with_mnemonic (NULL, _("Mono to Stereo"));
  gtk_widget_show (radiobutton1to2);
  gtk_box_pack_start (GTK_BOX (vbox7), radiobutton1to2, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1to2), radiobutton_2to2_group);
  radiobutton_2to2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1to2));

  label6 = gtk_label_new (_("<b>Channels</b>"));
  gtk_widget_show (label6);
  gtk_frame_set_label_widget (GTK_FRAME (frame4), label6);
  gtk_label_set_use_markup (GTK_LABEL (label6), TRUE);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);

  dialog_action_area1 = GTK_DIALOG (dialogAudio)->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 (dialogAudio), 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 (dialogAudio), 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 (dialogAudio, dialogAudio, "dialogAudio");
  GLADE_HOOKUP_OBJECT_NO_REF (dialogAudio, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialogAudio, vbox3, "vbox3");
  GLADE_HOOKUP_OBJECT (dialogAudio, frame3, "frame3");
  GLADE_HOOKUP_OBJECT (dialogAudio, vbox6, "vbox6");
  GLADE_HOOKUP_OBJECT (dialogAudio, checkbuttonNormalize, "checkbuttonNormalize");
  GLADE_HOOKUP_OBJECT (dialogAudio, checkbuttonDRC, "checkbuttonDRC");
  GLADE_HOOKUP_OBJECT (dialogAudio, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (dialogAudio, checkbuttonTimeShift, "checkbuttonTimeShift");
  GLADE_HOOKUP_OBJECT (dialogAudio, entryTimeshift, "entryTimeshift");
  GLADE_HOOKUP_OBJECT (dialogAudio, label5, "label5");
  GLADE_HOOKUP_OBJECT (dialogAudio, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (dialogAudio, vbox4, "vbox4");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobuttonNone, "radiobuttonNone");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton2, "radiobutton2");
  GLADE_HOOKUP_OBJECT (dialogAudio, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobuttonSox, "radiobuttonSox");
  GLADE_HOOKUP_OBJECT (dialogAudio, entryFrequency, "entryFrequency");
  GLADE_HOOKUP_OBJECT (dialogAudio, label3, "label3");
  GLADE_HOOKUP_OBJECT (dialogAudio, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (dialogAudio, vbox5, "vbox5");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton_fpsnone, "radiobutton_fpsnone");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton_fpsfilm, "radiobutton_fpsfilm");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton_fpsPAL, "radiobutton_fpsPAL");
  GLADE_HOOKUP_OBJECT (dialogAudio, label4, "label4");
  GLADE_HOOKUP_OBJECT (dialogAudio, frame4, "frame4");
  GLADE_HOOKUP_OBJECT (dialogAudio, vbox7, "vbox7");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton_2to2, "radiobutton_2to2");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton2to1, "radiobutton2to1");
  GLADE_HOOKUP_OBJECT (dialogAudio, radiobutton1to2, "radiobutton1to2");
  GLADE_HOOKUP_OBJECT (dialogAudio, label6, "label6");
  GLADE_HOOKUP_OBJECT_NO_REF (dialogAudio, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialogAudio, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialogAudio, okbutton1, "okbutton1");

  return dialogAudio;
}
Ejemplo n.º 25
0
GtkWidget* build_gui ( void ) {
  GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *vbox2;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkWidget *radiobutton1;
  GSList *radiobutton1_group = NULL;
  GtkWidget *radiobutton2;
  GtkWidget *entry1;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window1), "tracking antenna");

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);

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

  table1 = gtk_table_new (4, 3, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox2), table1, TRUE, TRUE, 0);
  gtk_table_set_col_spacings (GTK_TABLE (table1), 5);

  label1 = gtk_label_new ("Azimuth");
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  label2 = gtk_label_new ("Elevation");
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);

  label3 = gtk_label_new ("Id");
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  label4 = gtk_label_new ("mode");
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, "manual");
  gtk_widget_show (radiobutton1);
  gtk_table_attach (GTK_TABLE (table1), radiobutton1, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton1_group);
  radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1));

  radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, "tracking");
  gtk_widget_show (radiobutton2);
  gtk_table_attach (GTK_TABLE (table1), radiobutton2, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobutton1_group);
  radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2));

  azim_scale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (144.7, 0, 360, 1, 1, 1)));
  gtk_widget_show (azim_scale);
  gtk_table_attach (GTK_TABLE (table1), azim_scale, 1, 3, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_range_set_update_policy (GTK_RANGE (azim_scale), GTK_UPDATE_DELAYED);

  elev_scale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (32.3, 0, 90, 1, 1, 1)));
  gtk_widget_show (elev_scale);
  gtk_table_attach (GTK_TABLE (table1), elev_scale, 1, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

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

  g_signal_connect ((gpointer) radiobutton1, "toggled",
                    G_CALLBACK (on_mode_changed),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (window1, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (window1, table1, "table1");
  GLADE_HOOKUP_OBJECT (window1, label1, "label1");
  GLADE_HOOKUP_OBJECT (window1, label2, "label2");
  GLADE_HOOKUP_OBJECT (window1, label3, "label3");
  GLADE_HOOKUP_OBJECT (window1, label4, "label4");
  GLADE_HOOKUP_OBJECT (window1, radiobutton1, "radiobutton1");
  GLADE_HOOKUP_OBJECT (window1, radiobutton2, "radiobutton2");
  GLADE_HOOKUP_OBJECT (window1, entry1, "entry1");

  return window1;
}
Ejemplo n.º 26
0
Archivo: joind.c Proyecto: ArdaXi/XChat
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), _("XChat: 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_MOUSE);

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

	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-yes", GTK_ICON_SIZE_DIALOG);
	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 (label)->wrap = 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.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 (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_box_pack_end (GTK_BOX (GTK_DIALOG (dialog1)->action_area), okbutton1, FALSE, TRUE, 0);
	GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

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

	gtk_widget_grab_focus (okbutton1);
	gtk_widget_show_all (dialog1);
}
dialogo_propiedades_red_t * dialogo_propiedades_red_crear() {
    dialogo_propiedades_red_t * dialogo_propiedades_red =
        (dialogo_propiedades_red_t*)malloc(sizeof(dialogo_propiedades_red_t));

    dialogo_propiedades_red->rbt_ordenes_group = NULL;
    dialogo_propiedades_red->dlg_propiedades_red = gtk_dialog_new ();
    gtk_window_set_title (GTK_WINDOW (dialogo_propiedades_red->dlg_propiedades_red), "Propiedades de la red");

    dialogo_propiedades_red->dialog_vbox1 = GTK_DIALOG (dialogo_propiedades_red->dlg_propiedades_red)->vbox;
    gtk_widget_show (dialogo_propiedades_red->dialog_vbox1);

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

    dialogo_propiedades_red->label1 = gtk_label_new_with_mnemonic ("_Ruta del archivo:");
    gtk_widget_show (dialogo_propiedades_red->label1);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->vbox1), dialogo_propiedades_red->label1, FALSE, FALSE, 0);

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

    dialogo_propiedades_red->entry_ruta = gtk_entry_new ();
    gtk_widget_show (dialogo_propiedades_red->entry_ruta);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->hbox1), dialogo_propiedades_red->entry_ruta, TRUE, TRUE, 0);

    dialogo_propiedades_red->button1 = gtk_button_new ();
    gtk_widget_show (dialogo_propiedades_red->button1);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->hbox1), dialogo_propiedades_red->button1, FALSE, FALSE, 0);

    dialogo_propiedades_red->alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
    gtk_widget_show (dialogo_propiedades_red->alignment1);
    gtk_container_add (GTK_CONTAINER (dialogo_propiedades_red->button1), dialogo_propiedades_red->alignment1);

    dialogo_propiedades_red->hbox2 = gtk_hbox_new (FALSE, 2);
    gtk_widget_show (dialogo_propiedades_red->hbox2);
    gtk_container_add (GTK_CONTAINER (dialogo_propiedades_red->alignment1), dialogo_propiedades_red->hbox2);

    dialogo_propiedades_red->image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show (dialogo_propiedades_red->image1);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->hbox2), dialogo_propiedades_red->image1, FALSE, FALSE, 0);

    dialogo_propiedades_red->label4 = gtk_label_new_with_mnemonic ("_...");
    gtk_widget_show (dialogo_propiedades_red->label4);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->hbox2), dialogo_propiedades_red->label4, FALSE, FALSE, 0);

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

    dialogo_propiedades_red->frame1 = gtk_frame_new (NULL);
    gtk_widget_show (dialogo_propiedades_red->frame1);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->vbox1), dialogo_propiedades_red->frame1, TRUE, TRUE, 0);

    dialogo_propiedades_red->vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (dialogo_propiedades_red->vbox2);
    gtk_container_add (GTK_CONTAINER (dialogo_propiedades_red->frame1), dialogo_propiedades_red->vbox2);

    dialogo_propiedades_red->rbt_ordenes = gtk_radio_button_new_with_mnemonic (NULL, "\303\223_rdenes");
    gtk_widget_show (dialogo_propiedades_red->rbt_ordenes);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->vbox2), dialogo_propiedades_red->rbt_ordenes, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (dialogo_propiedades_red->rbt_ordenes), dialogo_propiedades_red->rbt_ordenes_group);
    dialogo_propiedades_red->rbt_ordenes_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (dialogo_propiedades_red->rbt_ordenes));

    dialogo_propiedades_red->rbt_parametros = gtk_radio_button_new_with_mnemonic (NULL, "P_ar\303\241metros");
    gtk_widget_show (dialogo_propiedades_red->rbt_parametros);
    gtk_box_pack_start (GTK_BOX (dialogo_propiedades_red->vbox2), dialogo_propiedades_red->rbt_parametros, FALSE, FALSE, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (dialogo_propiedades_red->rbt_parametros), dialogo_propiedades_red->rbt_ordenes_group);
    dialogo_propiedades_red->rbt_ordenes_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (dialogo_propiedades_red->rbt_parametros));

    dialogo_propiedades_red->label3 = gtk_label_new ("M\303\263dulo");
    gtk_widget_show (dialogo_propiedades_red->label3);
    gtk_frame_set_label_widget (GTK_FRAME (dialogo_propiedades_red->frame1), dialogo_propiedades_red->label3);

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

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

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

    g_signal_connect((gpointer) dialogo_propiedades_red->button1, "clicked",
                     G_CALLBACK(boton_abrir), dialogo_propiedades_red);

    return dialogo_propiedades_red;

}
Ejemplo n.º 28
0
orcaData orcaGtk::ex_set_attr(orcaVM* vm, int n)/*{{{*/
{
	if (n < 2) vm->need_param();
	orcaData key = vm->get_param(0);
	orcaData val = vm->get_param(1);
	attr[key] = val;

	if ((type == GUI_LIST || type == GUI_TREE) && is<TYPE_STR>(key)) {
		if (key.s() == "column") {
			orcaList* lp = castobj<orcaList>(val);
			if (lp == NULL) {
				throw orcaException(vm, "orca.type", "list type is required");
			}

			int width = lp->size();
			GtkCellRenderer *renderer;
			GtkTreeViewColumn *column;

			vector<pair<GtkCellRenderer*, orcaObject*> > signals;

			GType* types = new GType[width];

			for (int i=0; i<width; i++) {
				orcaTuple* tp = NULL;
				if (is<TYPE_STR>(lp->at(i))) {
					renderer = gtk_cell_renderer_text_new();
					column = gtk_tree_view_column_new_with_attributes(lp->at(i).String().c_str(), renderer, "text", i, NULL);
					types[i] = G_TYPE_STRING;
				}
				else if (tp = castobj<orcaTuple>(lp->at(i))) {
					string type = tp->at(1).String();
					if (type == "string") {
						renderer = gtk_cell_renderer_text_new();
						column = gtk_tree_view_column_new_with_attributes(tp->at(0).String().c_str(), renderer, "text", i, NULL);
						types[i] = G_TYPE_STRING;
					}
					else if (type == "toggle") {
						renderer = gtk_cell_renderer_toggle_new();
						column = gtk_tree_view_column_new_with_attributes(tp->at(0).String().c_str(), renderer, "active", i, NULL);

						if (tp->size() >= 3) {
							pair<GtkCellRenderer*, orcaObject*> p;
							p.first = renderer;
							p.second = tp->at(2).Object();
							signals.push_back(p);
						}

						types[i] = G_TYPE_BOOLEAN;
					}
				}

				gtk_tree_view_append_column(GTK_TREE_VIEW(handle), column);
			}

			if (type == GUI_LIST)
				store = GTK_TREE_MODEL(gtk_list_store_newv(width, types));
			else
				store = GTK_TREE_MODEL(gtk_tree_store_newv(width, types));

			delete types;

			gtk_tree_view_set_model(GTK_TREE_VIEW(handle), store);

			// register toggle signal
			if (!signals.empty()) {
				GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(handle));
				for (int i=0; i<signals.size(); i++) {
					signal_t* p = new signal_t;

					p->fun = signals[i].second;
					p->tree = model;
					p->owner = this;
					m_signals.push_back(p);

					if (type == GUI_LIST) {
						g_signal_connect(signals[i].first, "toggled",
										 G_CALLBACK(gui_list_toggled_callback), (gpointer)p);
					}
					else {
						g_signal_connect(signals[i].first, "toggled",
										 G_CALLBACK(gui_tree_toggled_callback), (gpointer)p);
					}
				}
			}

		}
	}
	else if (type == GUI_WINDOW && is<TYPE_STR>(key)) {
		if (key.s() == "wh") {
			if (isobj<orcaTuple>(val)) {
				orcaTuple* tp = castobj<orcaTuple>(val);
				int w = tp->at(0).Integer();
				int h = tp->at(1).Integer();
				gtk_window_set_default_size(GTK_WINDOW(handle), w, h);
				gtk_window_resize(GTK_WINDOW(handle), w, h);
			}
		}
		else if (key.s() == "xy") {
			if (isobj<orcaTuple>(val)) {
				orcaTuple* tp = castobj<orcaTuple>(val);
				int x = tp->at(0).Integer();
				int y = tp->at(1).Integer();
				gtk_window_move(GTK_WINDOW(handle), x, y);
			}
		}
		else if (key.s() == "resizable") {
			bool flag = val.Boolean();
			gtk_window_set_resizable(GTK_WINDOW(handle), flag);
		}
	}
	else if (type == GUI_RADIO && is<TYPE_STR>(key)) {
		if (key.s() == "group") {
			orcaObject* op = attr["group"].Object();
			orcaGtk* gp = castobj<orcaGtk>(op->get_member("handle"));
			if (gp == NULL) {
				throw orcaException(vm, "orca.param", "invalid radio");
			}

			GSList* group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(gp->handle));
			gtk_radio_button_set_group(GTK_RADIO_BUTTON(handle), group);
		}
	}
	else if (type == GUI_TABLE && is<TYPE_STR>(key)) {
		if (key.s() == "wh") {
			orcaData d = attr["wh"];
			if (isobj<orcaTuple>(d)) {
				orcaTuple* tp = castobj<orcaTuple>(d);
				int w = tp->at(0).Integer();
				int h = tp->at(1).Integer();
				handle = gtk_table_new(w, h, TRUE);
			}
		}
	}
	else if (type == GUI_BUTTON && is<TYPE_STR>(key)) {
		if (key.s() == "wh") {
			orcaData d = attr["wh"];
			if (isobj<orcaTuple>(d)) {
				orcaTuple* tp = castobj<orcaTuple>(val);
				int w = tp->at(0).Integer();
				int h = tp->at(1).Integer();
				gtk_widget_set_size_request(handle, w, h);
			}
		}
	}
	else if (type == GUI_IMAGE && is<TYPE_STR>(key)) {
		if (key.s() == "file") {
			gtk_image_set_from_file(GTK_IMAGE(handle), val.String().c_str());
		}

		if (key.s() == "file" || key.s() == "wh") {
			orcaData d = attr["wh"];
			if (isobj<orcaTuple>(d)) {
				orcaTuple* tp = castobj<orcaTuple>(d);
				int w = tp->at(0).Integer();
				int h = tp->at(1).Integer();

				GdkPixbuf *pixbuf =	gtk_image_get_pixbuf(GTK_IMAGE(handle));
				if (pixbuf == NULL) {
					return NIL;
				}
				
				pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, GDK_INTERP_BILINEAR);
				gtk_image_set_from_pixbuf(GTK_IMAGE(handle), pixbuf);
			}
		}
	}


	return NIL;
}
Ejemplo n.º 29
0
void ui_common_study_preferences_widgets(GtkWidget * packing_table,
					 gint table_row,
					 GtkWidget ** proi_width_spin,
					 GnomeCanvasItem ** proi_item,
#ifdef AMIDE_LIBGNOMECANVAS_AA
					 GtkWidget ** proi_transparency_spin,
#else
					 GtkWidget ** pline_style_menu,
					 GtkWidget ** pfill_roi_button,
#endif
					 GtkWidget ** playout_button1,
					 GtkWidget ** playout_button2,
					 GtkWidget ** ppanel_layout_button1,
					 GtkWidget ** ppanel_layout_button2,
					 GtkWidget ** ppanel_layout_button3,
					 GtkWidget ** pmaintain_size_button,
					 GtkWidget ** ptarget_size_spin) {

  GtkWidget * label;
  GtkObject * adjustment;
  GtkWidget * roi_canvas;
  GnomeCanvasPoints * roi_line_points;
  GtkWidget * image;
  GtkWidget * hseparator;
#ifndef AMIDE_LIBGNOMECANVAS_AA
  GdkLineStyle i_line_style;
#endif


  /* widgets to change the roi's size */
  label = gtk_label_new(_("ROI Width (pixels)"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1,
		   0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  adjustment = gtk_adjustment_new(AMITK_PREFERENCES_MIN_ROI_WIDTH,
				  AMITK_PREFERENCES_MIN_ROI_WIDTH,
				  AMITK_PREFERENCES_MAX_ROI_WIDTH,1.0, 1.0, 0.0);
  *proi_width_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1.0, 0);
  gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*proi_width_spin),FALSE);
  gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(*proi_width_spin), TRUE);
  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*proi_width_spin), TRUE);
  gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(*proi_width_spin), GTK_UPDATE_ALWAYS);
  gtk_table_attach(GTK_TABLE(packing_table), *proi_width_spin, 1,2, 
		   table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(*proi_width_spin);

  /* a little canvas indicator thingie to show the user who the new preferences will look */
#ifdef AMIDE_LIBGNOMECANVAS_AA
  roi_canvas = gnome_canvas_new_aa();
#else
  roi_canvas = gnome_canvas_new();
#endif
  gtk_widget_set_size_request(roi_canvas, 100, 100);
  gnome_canvas_set_scroll_region(GNOME_CANVAS(roi_canvas), 0.0, 0.0, 100.0, 100.0);
  gtk_table_attach(GTK_TABLE(packing_table),  roi_canvas, 2,3,table_row,table_row+2,
		   GTK_FILL, 0,  X_PADDING, Y_PADDING);
  gtk_widget_show(roi_canvas);

  /* the box */
  roi_line_points = gnome_canvas_points_new(5);
  roi_line_points->coords[0] = 25.0; /* x1 */
  roi_line_points->coords[1] = 25.0; /* y1 */
  roi_line_points->coords[2] = 75.0; /* x2 */
  roi_line_points->coords[3] = 25.0; /* y2 */
  roi_line_points->coords[4] = 75.0; /* x3 */
  roi_line_points->coords[5] = 75.0; /* y3 */
  roi_line_points->coords[6] = 25.0; /* x4 */
  roi_line_points->coords[7] = 75.0; /* y4 */
  roi_line_points->coords[8] = 25.0; /* x4 */
  roi_line_points->coords[9] = 25.0; /* y4 */

  
  *proi_item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(roi_canvas)), 
#ifdef AMIDE_LIBGNOMECANVAS_AA
				     gnome_canvas_polygon_get_type(),
#else
				     gnome_canvas_line_get_type(),
#endif
				     "points", roi_line_points, 
				     NULL);
  gnome_canvas_points_unref(roi_line_points);
  table_row++;


#ifdef AMIDE_LIBGNOMECANVAS_AA
  /* widget to change the transparency level */
  /* only works for anti-aliased canvases */
  /* widgets to change the roi's size */

  label = gtk_label_new(_("ROI Transparency"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0, 1, table_row, table_row+1,
		   0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  *proi_transparency_spin = gtk_spin_button_new_with_range(0.0,1.0,AMITK_PREFERENCES_DEFAULT_CANVAS_ROI_TRANSPARENCY);
  gtk_spin_button_set_increments(GTK_SPIN_BUTTON(*proi_transparency_spin),0.1,0.1);
  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*proi_transparency_spin),FALSE);
  gtk_table_attach(GTK_TABLE(packing_table), *proi_transparency_spin, 1,2, 
		   table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(*proi_transparency_spin);
  table_row++;
#else
  /* widgets to change the roi's line style */
  /* Anti-aliased canvas doesn't yet support this */
  /* also need to remove #ifndef for relevant lines in amitk_canvas_object.c and other locations  */
  label = gtk_label_new(_("ROI Line Style:"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 0,1,
  		   table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  *pline_style_menu = gtk_combo_box_new_text();
  for (i_line_style=0; i_line_style<=GDK_LINE_DOUBLE_DASH; i_line_style++) 
     gtk_combo_box_append_text(GTK_COMBO_BOX(*pline_style_menu),
			       line_style_names[i_line_style]);
  gtk_widget_set_size_request (*pline_style_menu, 125, -1);
  gtk_table_attach(GTK_TABLE(packing_table),  *pline_style_menu, 1,2, 
  		   table_row,table_row+1, GTK_FILL, 0,  X_PADDING, Y_PADDING);
  gtk_widget_show(*pline_style_menu);
  table_row++;

  /* do we want to fill in isocontour roi's */
  label = gtk_label_new(_("Draw Isocontours/Freehands Filled:"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  *pfill_roi_button = gtk_check_button_new();
  gtk_table_attach(GTK_TABLE(packing_table), *pfill_roi_button,
		   1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(*pfill_roi_button);
  table_row++;
#endif

  hseparator = gtk_hseparator_new();
  gtk_table_attach(GTK_TABLE(packing_table), hseparator, 
		   0, 3, table_row, table_row+1,
		   GTK_FILL, 0, X_PADDING, Y_PADDING);
  table_row++;
  gtk_widget_show(hseparator);


  label = gtk_label_new(_("Canvas Layout:"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1,
		   0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  /* the radio buttons */
  *playout_button1 = gtk_radio_button_new(NULL);
  image = gtk_image_new_from_stock("amide_icon_layout_linear",GTK_ICON_SIZE_DIALOG);
  gtk_button_set_image(GTK_BUTTON(*playout_button1), image);
  gtk_table_attach(GTK_TABLE(packing_table), *playout_button1,
  		   1,2, table_row, table_row+1,
  		   0, 0, X_PADDING, Y_PADDING);
  g_object_set_data(G_OBJECT(*playout_button1), "layout", GINT_TO_POINTER(AMITK_LAYOUT_LINEAR));
  gtk_widget_show(*playout_button1);

  *playout_button2 = gtk_radio_button_new(NULL);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(*playout_button2), 
			     gtk_radio_button_get_group(GTK_RADIO_BUTTON(*playout_button1)));
  image = gtk_image_new_from_stock("amide_icon_layout_orthogonal",GTK_ICON_SIZE_DIALOG);
  gtk_button_set_image(GTK_BUTTON(*playout_button2), image);
  gtk_table_attach(GTK_TABLE(packing_table), *playout_button2, 2,3, table_row, table_row+1,
  		   0, 0, X_PADDING, Y_PADDING);
  g_object_set_data(G_OBJECT(*playout_button2), "layout", GINT_TO_POINTER(AMITK_LAYOUT_ORTHOGONAL));
  gtk_widget_show(*playout_button2);

  table_row++;


  label = gtk_label_new(_("Multiple Canvases Layout:"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1,
		   0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  /* the radio buttons */
  *ppanel_layout_button1 = gtk_radio_button_new(NULL);
  image = gtk_image_new_from_stock("amide_icon_panels_mixed", GTK_ICON_SIZE_LARGE_TOOLBAR);
  gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button1), image);
  gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button1,
  		   1,2, table_row, table_row+1,
  		   0, 0, X_PADDING, Y_PADDING);
  g_object_set_data(G_OBJECT(*ppanel_layout_button1), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_MIXED));
  gtk_widget_show(*ppanel_layout_button1);

  *ppanel_layout_button2 = gtk_radio_button_new(NULL);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(*ppanel_layout_button2), 
			     gtk_radio_button_get_group(GTK_RADIO_BUTTON(*ppanel_layout_button1)));
  image = gtk_image_new_from_stock("amide_icon_panels_linear_x", GTK_ICON_SIZE_LARGE_TOOLBAR);
  gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button2), image);
  gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button2,
  		   2,3, table_row, table_row+1,
  		   0, 0, X_PADDING, Y_PADDING);
  g_object_set_data(G_OBJECT(*ppanel_layout_button2), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_LINEAR_X));
  gtk_widget_show(*ppanel_layout_button2);

  *ppanel_layout_button3 = gtk_radio_button_new(NULL);
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(*ppanel_layout_button3), 
			     gtk_radio_button_get_group(GTK_RADIO_BUTTON(*ppanel_layout_button1)));
  image = gtk_image_new_from_stock("amide_icon_panels_linear_y", GTK_ICON_SIZE_LARGE_TOOLBAR);
  gtk_button_set_image(GTK_BUTTON(*ppanel_layout_button3), image);
  gtk_table_attach(GTK_TABLE(packing_table), *ppanel_layout_button3,
  		   3,4, table_row, table_row+1,
  		   0, 0, X_PADDING, Y_PADDING);
  g_object_set_data(G_OBJECT(*ppanel_layout_button3), "panel_layout", GINT_TO_POINTER(AMITK_PANEL_LAYOUT_LINEAR_Y));
  gtk_widget_show(*ppanel_layout_button3);

  table_row++;


  /* do we want the size of the canvas to not resize */
  label = gtk_label_new(_("Maintain view size constant:"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  *pmaintain_size_button = gtk_check_button_new();
  gtk_table_attach(GTK_TABLE(packing_table), *pmaintain_size_button, 
		   1,2, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(*pmaintain_size_button);
  table_row++;


  /* widgets to change the amount of empty space in the center of the target */
  label = gtk_label_new(_("Target Empty Area (pixels)"));
  gtk_table_attach(GTK_TABLE(packing_table), label, 
		   0,1, table_row, table_row+1, 0, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(label);

  adjustment = gtk_adjustment_new(AMITK_PREFERENCES_MIN_TARGET_EMPTY_AREA, 
				  AMITK_PREFERENCES_MIN_TARGET_EMPTY_AREA, 
				  AMITK_PREFERENCES_MAX_TARGET_EMPTY_AREA, 1.0, 1.0, 0.0);
  *ptarget_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1.0, 0);
  gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(*ptarget_size_spin),FALSE);
  gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(*ptarget_size_spin), TRUE);
  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(*ptarget_size_spin), TRUE);
  gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(*ptarget_size_spin), GTK_UPDATE_ALWAYS);

  gtk_table_attach(GTK_TABLE(packing_table), *ptarget_size_spin, 1,2, 
		   table_row, table_row+1, GTK_FILL, 0, X_PADDING, Y_PADDING);
  gtk_widget_show(*ptarget_size_spin);


  return;
}
Ejemplo n.º 30
0
GtkWidget	*create_dialog1 (uint8_t prefilled)
{
    GtkWidget *dialog1;
    GtkWidget *dialog_vbox1;
    GtkWidget *vbox1;
    GtkWidget *hbox2;
    GtkWidget *labelmpeg;
    GtkWidget *button_mpeg;
    GtkWidget *hbox3;
    GtkWidget *label_index;
    GtkWidget *button_index;
    GtkWidget *hbox1;
    GtkWidget *table1;
    GtkWidget *radiobutton_ac3;

    GSList *radiobutton_ac3_group = NULL;



    GtkWidget *radiobutton_mpeg;


    GtkWidget *radiobutton1;
    GtkWidget *button_scan;
    GtkWidget *dialog_action_area1;
    GtkWidget *cancelbutton1;
    GtkWidget *okbutton1;



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

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

    labelmpeg = gtk_label_new ("");
    gtk_widget_show (labelmpeg);
    gtk_box_pack_start (GTK_BOX (hbox2), labelmpeg, TRUE, FALSE, 0);

    button_mpeg = gtk_button_new_with_mnemonic (_("Select Mpeg"));
    gtk_widget_show (button_mpeg);
    gtk_box_pack_start (GTK_BOX (hbox2), button_mpeg, FALSE, FALSE, 0);

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

    label_index = gtk_label_new ("");
    gtk_widget_show (label_index);
    gtk_box_pack_start (GTK_BOX (hbox3), label_index, TRUE, FALSE, 0);

    button_index = gtk_button_new_with_mnemonic (_("Select Index"));
    gtk_widget_show (button_index);
    gtk_box_pack_start (GTK_BOX (hbox3), button_index, FALSE, FALSE, 0);

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

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

    radiobutton_ac3 = gtk_radio_button_new_with_mnemonic (NULL, _("AC3 audio"));
    gtk_widget_show (radiobutton_ac3);
    gtk_table_attach (GTK_TABLE (table1), radiobutton_ac3, 0, 1, 1, 2,
                      (GtkAttachOptions) (GTK_FILL),
                      (GtkAttachOptions) (0), 0, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_ac3), radiobutton_ac3_group);
    radiobutton_ac3_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_ac3));
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_ac3), TRUE);





    radiobutton_mpeg = gtk_radio_button_new_with_mnemonic (NULL, _("Mpeg audio"));
    gtk_widget_show (radiobutton_mpeg);
    gtk_table_attach (GTK_TABLE (table1), radiobutton_mpeg, 0, 1, 0, 1,
                      (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                      (GtkAttachOptions) (0), 0, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_mpeg), radiobutton_ac3_group);
    radiobutton_ac3_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_mpeg));


    /*------------------*/
    menuBuild(table1,NULL);
//--------------------------------------------------

    /*---------------*/

    radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, _("LPCM"));
    gtk_widget_show (radiobutton1);
    gtk_table_attach (GTK_TABLE (table1), radiobutton1, 0, 1, 2, 3,
                      (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                      (GtkAttachOptions) (0), 0, 0);
    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton_ac3_group);
    radiobutton_ac3_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1));

    button_scan = gtk_button_new_with_mnemonic (_("Scan file for audio stream"));
    gtk_widget_show (button_scan);
    gtk_box_pack_start (GTK_BOX (vbox1), button_scan, FALSE, FALSE, 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, hbox2, "hbox2");
    GLADE_HOOKUP_OBJECT (dialog1, labelmpeg, "labelmpeg");
    GLADE_HOOKUP_OBJECT (dialog1, button_mpeg, "button_mpeg");
    GLADE_HOOKUP_OBJECT (dialog1, hbox3, "hbox3");
    GLADE_HOOKUP_OBJECT (dialog1, label_index, "label_index");
    GLADE_HOOKUP_OBJECT (dialog1, button_index, "button_index");
    GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
    GLADE_HOOKUP_OBJECT (dialog1, table1, "table1");
    GLADE_HOOKUP_OBJECT (dialog1, radiobutton_ac3, "radiobutton_ac3");
    GLADE_HOOKUP_OBJECT (dialog1, optionmenuL, "optionmenuL");
//  GLADE_HOOKUP_OBJECT (dialog1, menu3, "menu3");

    GLADE_HOOKUP_OBJECT (dialog1, radiobutton_mpeg, "radiobutton_mpeg");
    GLADE_HOOKUP_OBJECT (dialog1, optionmenuM, "optionmenuM");
//  GLADE_HOOKUP_OBJECT (dialog1, menu1, "menu1");

    GLADE_HOOKUP_OBJECT (dialog1, optionmenuA, "optionmenuA");
//  GLADE_HOOKUP_OBJECT (dialog1, menu2, "menu2");
    GLADE_HOOKUP_OBJECT (dialog1, radiobutton1, "radiobutton1");
    GLADE_HOOKUP_OBJECT (dialog1, button_scan, "button_scan");
    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;
}