Example #1
0
File: about.c Project: ApOgEE/geany
static GtkWidget *create_dialog(void)
{
	GtkWidget *dialog;
	GtkWidget *header_image;
	GtkWidget *header_label;
	GtkWidget *label_info;
	GtkWidget *codename_label;
	GtkWidget *builddate_label;
	GtkWidget *url_button;
	GtkWidget *cop_label;
	GtkWidget *label;
	GtkWidget *license_textview;
	GtkWidget *notebook;
	GtkWidget *box;
	GtkWidget *credits_scrollwin;
	GtkWidget *table;
	GtkWidget *license_scrollwin;
	GtkWidget *info_box;
	GtkWidget *header_hbox;
	GtkWidget *header_eventbox;
	GdkPixbuf *icon;
	GtkTextBuffer* tb;
	gchar *license_text = NULL;
	gchar buffer[512];
	gchar buffer2[128];
	guint i, row = 0;

	dialog = gtk_dialog_new();

	/* configure dialog */
	gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
	gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_title(GTK_WINDOW(dialog), _("About Geany"));
	gtk_widget_set_name(dialog, "GeanyDialog");
	gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
	gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
	g_signal_connect(dialog, "key-press-event", G_CALLBACK(gb_on_key_pressed), NULL);

	/* create header */
	header_eventbox = gtk_event_box_new();
	gtk_widget_show(header_eventbox);
	header_hbox = gtk_hbox_new(FALSE, 12);
	gtk_container_set_border_width(GTK_CONTAINER(header_hbox), 4);
	gtk_widget_show(header_hbox);
	gtk_container_add(GTK_CONTAINER(header_eventbox), header_hbox);
	header_image = gtk_image_new();
	gtk_box_pack_start(GTK_BOX(header_hbox), header_image, FALSE, FALSE, 0);
	header_label = gtk_label_new(NULL);
	gtk_label_set_use_markup(GTK_LABEL(header_label), TRUE);
	/* print the subversion revision generated by ./configure if it is available */
	g_snprintf(buffer, sizeof(buffer), HEADER, main_get_version_string());
	gtk_label_set_markup(GTK_LABEL(header_label), buffer);
	gtk_widget_show(header_label);
	gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE, FALSE, 0);
	header_eventbox_style_set(header_eventbox);
	header_label_style_set(header_label);
	g_signal_connect_after(header_eventbox, "style-set", G_CALLBACK(header_eventbox_style_set), NULL);
	g_signal_connect_after(header_label, "style-set", G_CALLBACK(header_label_style_set), NULL);
	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), header_eventbox, FALSE, FALSE, 0);

	/* set image */
	icon = ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO);
	gtk_image_set_from_pixbuf(GTK_IMAGE(header_image), icon);
	gtk_window_set_icon(GTK_WINDOW(dialog), icon);
	g_object_unref(icon);	/* free our reference */

	/* create notebook */
	notebook = gtk_notebook_new();
	gtk_widget_show(notebook);
	gtk_container_set_border_width(GTK_CONTAINER(notebook), 2);
	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);

	/* create "Info" tab */
	info_box = gtk_vbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(info_box), 6);
	gtk_widget_show(info_box);

	label_info = gtk_label_new(NULL);
	gtk_label_set_justify(GTK_LABEL(label_info), GTK_JUSTIFY_CENTER);
	gtk_label_set_selectable(GTK_LABEL(label_info), TRUE);
	gtk_label_set_use_markup(GTK_LABEL(label_info), TRUE);
	g_snprintf(buffer, sizeof(buffer), INFO, _("A fast and lightweight IDE"));
	gtk_label_set_markup(GTK_LABEL(label_info), buffer);
	gtk_misc_set_padding(GTK_MISC(label_info), 2, 11);
	gtk_widget_show(label_info);
	gtk_box_pack_start(GTK_BOX(info_box), label_info, FALSE, FALSE, 0);

	/* Codename label */
	codename_label = gtk_label_new(NULL);
	gtk_label_set_justify(GTK_LABEL(codename_label), GTK_JUSTIFY_CENTER);
	gtk_label_set_selectable(GTK_LABEL(codename_label), TRUE);
	gtk_label_set_use_markup(GTK_LABEL(codename_label), TRUE);
	gtk_label_set_markup(GTK_LABEL(codename_label), CODENAME);
	gtk_misc_set_padding(GTK_MISC(codename_label), 2, 8);
	gtk_widget_show(codename_label);
	gtk_box_pack_start(GTK_BOX(info_box), codename_label, FALSE, FALSE, 0);

	/* build date label */
	builddate_label = gtk_label_new(NULL);
	gtk_label_set_justify(GTK_LABEL(builddate_label), GTK_JUSTIFY_CENTER);
	gtk_label_set_selectable(GTK_LABEL(builddate_label), TRUE);
	gtk_label_set_use_markup(GTK_LABEL(builddate_label), TRUE);
	g_snprintf(buffer2, sizeof(buffer2), _("(built on or after %s)"), __DATE__);
	g_snprintf(buffer, sizeof(buffer), BUILDDATE, buffer2);
	gtk_label_set_markup(GTK_LABEL(builddate_label), buffer);
	gtk_misc_set_padding(GTK_MISC(builddate_label), 2, 2);
	gtk_widget_show(builddate_label);
	gtk_box_pack_start(GTK_BOX(info_box), builddate_label, FALSE, FALSE, 0);

	box = gtk_hbutton_box_new();
	url_button = gtk_button_new();
	gtk_button_set_relief(GTK_BUTTON(url_button), GTK_RELIEF_NONE);
	g_signal_connect(url_button, "clicked", G_CALLBACK(homepage_clicked), (gpointer)GEANY_HOMEPAGE);
	label = gtk_label_new(NULL);
	gtk_label_set_text(GTK_LABEL(label), GEANY_HOMEPAGE);
	gtk_widget_show(label);
	gtk_container_add(GTK_CONTAINER(url_button), label);
	gtk_widget_show(url_button);
	gtk_box_pack_start(GTK_BOX(box), url_button, FALSE, FALSE, 0);
	gtk_widget_show(box);
	gtk_box_pack_start(GTK_BOX(info_box), box, FALSE, FALSE, 10);

	/* copyright label */
	cop_label = gtk_label_new(NULL);
	gtk_label_set_justify(GTK_LABEL(cop_label), GTK_JUSTIFY_CENTER);
	gtk_label_set_selectable(GTK_LABEL(cop_label), FALSE);
	gtk_label_set_use_markup(GTK_LABEL(cop_label), TRUE);
	gtk_label_set_markup(GTK_LABEL(cop_label), COPYRIGHT);
	gtk_misc_set_padding(GTK_MISC(cop_label), 2, 10);
	gtk_widget_show(cop_label);
	gtk_box_pack_start(GTK_BOX(info_box), cop_label, FALSE, FALSE, 0);
	/*gtk_container_add(GTK_CONTAINER(info_box), cop_label); */

	label = gtk_label_new(_("Info"));
	gtk_widget_show(label);
	gtk_widget_show_all(info_box);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), info_box, label);

	/* create "Credits" tab */
	credits_scrollwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_container_set_border_width(GTK_CONTAINER(credits_scrollwin), 10);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(credits_scrollwin),
		GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

	table = gtk_table_new(23 + translators_len + prev_translators_len, 3, FALSE);
	gtk_table_set_col_spacings(GTK_TABLE(table), 10);

	row = 0;
	g_snprintf(buffer, sizeof(buffer),
		"<span size=\"larger\" weight=\"bold\">%s</span>", _("Developers"));
	label = gtk_label_new(buffer);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1, GTK_FILL, 0, 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer), "Colomban Wendling - %s", _("maintainer"));
	ROW(buffer, row, 0, 0, 0, 1);
	row++;
	ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
	row++;
	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer), "Nick Treleaven - %s", _("developer"));
	ROW(buffer, row, 0, 0, 0, 1);
	row++;
	ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
	row++;
	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer), "Enrico Tröger - %s", _("developer"));
	ROW(buffer, row, 0, 0, 0, 1);
	row++;
	ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
	row++;
	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer), "Matthew Brush - %s", _("developer"));
	ROW(buffer, row, 0, 0, 0, 1);
	row++;
	ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
	row++;
	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer), "Frank Lanitz - %s", _("translation maintainer"));
	ROW(buffer, row, 0, 0, 0, 1);
	row++;
	ROW("&lt;[email protected]&gt;", row, 0, 0, 0, 1);
	row++;
	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer),
		"<span size=\"larger\" weight=\"bold\">%s</span>", _("Translators"));
	label = gtk_label_new(buffer);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	row++;

	for (i = 0; i < translators_len; i++)
	{
		ROW(translators[i][0], row, 0, 1, 4, 0);
		ROW(translators[i][1], row, 1, 0, 4, 0);
		row++;
	}

	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer),
		"<span size=\"larger\" weight=\"bold\">%s</span>", _("Previous Translators"));
	label = gtk_label_new(buffer);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	row++;

	for (i = 0; i < prev_translators_len; i++)
	{
		ROW(prev_translators[i][0], row, 0, 1, 4, 0);
		ROW(prev_translators[i][1], row, 1, 0, 4, 0);
		row++;
	}


	ROW("", row, 0, 0, 0, 0);
	row++;

	g_snprintf(buffer, sizeof(buffer),
		"<span size=\"larger\" weight=\"bold\">%s</span>", _("Contributors"));
	label = gtk_label_new(buffer);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	row++;

	g_snprintf(buffer, sizeof(buffer),
		_("Some of the many contributors (for a more detailed list, see the file %s):"),
#ifdef G_OS_WIN32
			"Thanks.txt"
#else
			"THANKS"
#endif
		);
	label = geany_wrap_label_new(buffer);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
					(GtkAttachOptions) (GTK_FILL),
					(GtkAttachOptions) (0), 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	row++;

	label = geany_wrap_label_new(contributors);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
					(GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
					(GtkAttachOptions) (0), 0, 5);
	gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	row++;

	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(credits_scrollwin), table);
	gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_widget_get_parent(table)), GTK_SHADOW_NONE);
	gtk_widget_show_all(table);
	label = gtk_label_new(_("Credits"));
	gtk_widget_show(label);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), credits_scrollwin, label);

	/* create "License" tab */
	license_scrollwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_container_set_border_width(GTK_CONTAINER(license_scrollwin), 6);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(license_scrollwin),
		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	license_textview = gtk_text_view_new();
	gtk_text_view_set_editable(GTK_TEXT_VIEW(license_textview), FALSE);
	gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(license_textview), FALSE);
	gtk_widget_show(license_textview);
	gtk_container_add(GTK_CONTAINER(license_scrollwin), license_textview);
	label = gtk_label_new(_("License"));
	gtk_widget_show(label);

	g_snprintf(buffer, sizeof(buffer), "%s" G_DIR_SEPARATOR_S "GPL-2", app->datadir);

	g_file_get_contents(buffer, &license_text, NULL, NULL);
	if (license_text == NULL)
	{
		license_text = g_strdup(
			_("License text could not be found, please visit http://www.gnu.org/licenses/gpl-2.0.txt to view it online."));
	}
	tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(license_textview));
	gtk_text_buffer_set_text(tb, license_text, -1);

	g_free(license_text);

	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), license_scrollwin, label);

	gtk_widget_show_all(dialog);
	return dialog;
}
Example #2
0
int main(int argc, char* argv[])
{
	gtk_init(&argc,&argv);

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS was loaded");
		return 0;
	}

	// initialize BASS
	if (!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	if (!PlayFile()) { // start a file playing
		BASS_Free();
		return 0;
	}

	// create the window
	win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position(GTK_WINDOW(win),GTK_WIN_POS_CENTER);
	gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
	gtk_window_set_title(GTK_WINDOW(win),"BASS spectrum example (click to toggle mode)");
	g_signal_connect(win,"destroy",GTK_SIGNAL_FUNC(WindowDestroy),NULL);

	GtkWidget *ebox=gtk_event_box_new();
	gtk_container_add(GTK_CONTAINER(win),ebox);
	g_signal_connect(ebox,"button-release-event",GTK_SIGNAL_FUNC(WindowButtonRelease),NULL);

	// create the bitmap
	specpb=gdk_pixbuf_new(GDK_COLORSPACE_RGB,FALSE,8,SPECWIDTH,SPECHEIGHT);
	speci=gtk_image_new_from_pixbuf(specpb);
	gtk_container_add(GTK_CONTAINER(ebox),speci);

	{ // setup palette
		RGB *pal=palette;
		int a;
		memset(palette,0,sizeof(palette));
		for (a=1;a<128;a++) {
			pal[a].rgbGreen=256-2*a;
			pal[a].rgbRed=2*a;
		}
		for (a=0;a<32;a++) {
			pal[128+a].rgbBlue=8*a;
			pal[128+32+a].rgbBlue=255;
			pal[128+32+a].rgbRed=8*a;
			pal[128+64+a].rgbRed=255;
			pal[128+64+a].rgbBlue=8*(31-a);
			pal[128+64+a].rgbGreen=8*a;
			pal[128+96+a].rgbRed=255;
			pal[128+96+a].rgbGreen=255;
			pal[128+96+a].rgbBlue=8*a;
		}
	}

	// setup update timer (40hz)
	g_timeout_add(25,UpdateSpectrum,NULL);

	gtk_widget_show_all(win);
	gtk_main();

	gdk_pixbuf_unref(specpb);

	BASS_Free();

	return 0;
}
Example #3
0
static int gtkListMapMethod(Ihandle* ih)
{
  GtkScrolledWindow* scrolled_window = NULL;
  GtkListStore *store;

  store = gtk_list_store_new(1, G_TYPE_STRING);

  if (ih->data->is_dropdown)
  {
    GtkCellRenderer *renderer = NULL;

    if (ih->data->has_editbox)
      ih->handle = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(store), 0);
    else
      ih->handle = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
    g_object_unref(store);

    if (!ih->handle)
      return IUP_ERROR;

    g_object_set(G_OBJECT(ih->handle), "has-frame", TRUE, NULL);

    if (ih->data->has_editbox)
    {
      GtkWidget *entry;
#if GTK_CHECK_VERSION(2, 12, 0)
      GList* list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(ih->handle));
      renderer = list->data;
      g_list_free(list);
#endif

      entry = gtk_bin_get_child(GTK_BIN(ih->handle));
      iupAttribSetStr(ih, "_IUPGTK_ENTRY", (char*)entry);

      g_signal_connect(G_OBJECT(entry), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(entry), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(entry), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(entry), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(entry), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);
      g_signal_connect(G_OBJECT(entry), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);

      g_signal_connect(G_OBJECT(entry), "delete-text", G_CALLBACK(gtkListEditDeleteText), ih);
      g_signal_connect(G_OBJECT(entry), "insert-text", G_CALLBACK(gtkListEditInsertText), ih);
      g_signal_connect_after(G_OBJECT(entry), "move-cursor", G_CALLBACK(gtkListEditMoveCursor), ih);  /* only report some caret movements */
      g_signal_connect_after(G_OBJECT(entry), "key-release-event", G_CALLBACK(gtkListEditKeyReleaseEvent), ih);
      g_signal_connect(G_OBJECT(entry), "button-press-event", G_CALLBACK(gtkListEditButtonEvent), ih);  /* if connected "after" then it is ignored */
      g_signal_connect(G_OBJECT(entry), "button-release-event",G_CALLBACK(gtkListEditButtonEvent), ih);

      if (!iupStrBoolean(iupAttribGetStr(ih, "CANFOCUS")))
        GTK_WIDGET_FLAGS(ih->handle) &= ~GTK_CAN_FOCUS;
    }
    else
    {
      /* had to add an event box just to get get/killfocus,enter/leave events */
      GtkWidget *box = gtk_event_box_new();
      gtk_container_add((GtkContainer*)box, ih->handle);
      iupAttribSetStr(ih, "_IUP_EXTRAPARENT", (char*)box);

      renderer = gtk_cell_renderer_text_new();
      gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ih->handle), renderer, TRUE);
      gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ih->handle), renderer, "text", 0, NULL);

      g_signal_connect(G_OBJECT(box), "focus-in-event",  G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(box), "focus-out-event", G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(box), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(box), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "key-press-event", G_CALLBACK(iupgtkKeyPressEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "show-help",       G_CALLBACK(iupgtkShowHelp), ih);

      if (!iupStrBoolean(iupAttribGetStr(ih, "CANFOCUS")))
        GTK_WIDGET_FLAGS(ih->handle) &= ~GTK_CAN_FOCUS;
      else
        GTK_WIDGET_FLAGS(box) |= GTK_CAN_FOCUS;
    }

    g_signal_connect(ih->handle, "changed", G_CALLBACK(gtkListComboBoxChanged), ih);
    g_signal_connect(ih->handle, "notify::popup-shown", G_CALLBACK(gtkListComboBoxPopupShownChanged), ih);

    if (renderer)
    {
      renderer->xpad = 0;
      renderer->ypad = 0;
      iupAttribSetStr(ih, "_IUPGTK_RENDERER", (char*)renderer);
    }
  }
  else
  {
    GtkCellRenderer *renderer;
    GtkTreeSelection* selection;
    GtkTreeViewColumn *column;
    GtkPolicyType scrollbar_policy;

    ih->handle = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
    g_object_unref(store);

    if (!ih->handle)
      return IUP_ERROR;

    scrolled_window = (GtkScrolledWindow*)gtk_scrolled_window_new(NULL, NULL);

    if (ih->data->has_editbox)
    {
      GtkBox* vbox = (GtkBox*)gtk_vbox_new(FALSE, 0);

      GtkWidget *entry = gtk_entry_new();
      gtk_widget_show(entry);
      gtk_box_pack_start(vbox, entry, FALSE, FALSE, 0);
      iupAttribSetStr(ih, "_IUPGTK_ENTRY", (char*)entry);

      gtk_widget_show((GtkWidget*)vbox);
      gtk_box_pack_end(vbox, (GtkWidget*)scrolled_window, TRUE, TRUE, 0);
      iupAttribSetStr(ih, "_IUP_EXTRAPARENT", (char*)vbox);
      iupAttribSetStr(ih, "_IUPGTK_SCROLLED_WINDOW", (char*)scrolled_window);

      GTK_WIDGET_FLAGS(ih->handle) &= ~GTK_CAN_FOCUS; /* focus goes only to the edit box */
      if (!iupStrBoolean(iupAttribGetStr(ih, "CANFOCUS")))
        GTK_WIDGET_FLAGS(entry) &= ~GTK_CAN_FOCUS;

      g_signal_connect(G_OBJECT(entry), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(entry), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(entry), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(entry), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(entry), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

      g_signal_connect(G_OBJECT(entry), "delete-text", G_CALLBACK(gtkListEditDeleteText), ih);
      g_signal_connect(G_OBJECT(entry), "insert-text", G_CALLBACK(gtkListEditInsertText), ih);
      g_signal_connect_after(G_OBJECT(entry), "move-cursor", G_CALLBACK(gtkListEditMoveCursor), ih);  /* only report some caret movements */
      g_signal_connect(G_OBJECT(entry), "key-press-event",    G_CALLBACK(gtkListEditKeyPressEvent), ih);
      g_signal_connect_after(G_OBJECT(entry), "key-release-event", G_CALLBACK(gtkListEditKeyReleaseEvent), ih);
      g_signal_connect(G_OBJECT(entry), "button-press-event", G_CALLBACK(gtkListEditButtonEvent), ih);  /* if connected "after" then it is ignored */
      g_signal_connect(G_OBJECT(entry), "button-release-event",G_CALLBACK(gtkListEditButtonEvent), ih);
    }
    else
    {
      iupAttribSetStr(ih, "_IUP_EXTRAPARENT", (char*)scrolled_window);

      if (!iupStrBoolean(iupAttribGetStr(ih, "CANFOCUS")))
        GTK_WIDGET_FLAGS(ih->handle) &= ~GTK_CAN_FOCUS;

      g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(gtkListSimpleKeyPressEvent), ih);
      g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);
    }

    column = gtk_tree_view_column_new();

    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(column), renderer, TRUE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(column), renderer, "text", 0, NULL);

    iupAttribSetStr(ih, "_IUPGTK_RENDERER", (char*)renderer);
    g_object_set(G_OBJECT(renderer), "xpad", 0, NULL);
    g_object_set(G_OBJECT(renderer), "ypad", 0, NULL);

    gtk_tree_view_append_column(GTK_TREE_VIEW(ih->handle), column);
    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ih->handle), FALSE);
    gtk_tree_view_set_enable_search(GTK_TREE_VIEW(ih->handle), FALSE);

    gtk_container_add((GtkContainer*)scrolled_window, ih->handle);
    gtk_widget_show((GtkWidget*)scrolled_window);
    gtk_scrolled_window_set_shadow_type(scrolled_window, GTK_SHADOW_IN); 

    if (ih->data->sb)
    {
      if (iupStrBoolean(iupAttribGetStr(ih, "AUTOHIDE")))
        scrollbar_policy = GTK_POLICY_AUTOMATIC;
      else
        scrollbar_policy = GTK_POLICY_ALWAYS;
    }
    else
      scrollbar_policy = GTK_POLICY_NEVER;

    gtk_scrolled_window_set_policy(scrolled_window, scrollbar_policy, scrollbar_policy);

    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(ih->handle));
    if (!ih->data->has_editbox && ih->data->is_multiple)
    {
      gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
#if GTK_CHECK_VERSION(2, 10, 0)
      gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(ih->handle), TRUE);
#endif
    }
    else
      gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);

    g_signal_connect(G_OBJECT(selection), "changed",  G_CALLBACK(gtkListSelectionChanged), ih);
    g_signal_connect(G_OBJECT(ih->handle), "row-activated", G_CALLBACK(gtkListRowActivated), ih);
    g_signal_connect(G_OBJECT(ih->handle), "motion-notify-event",G_CALLBACK(iupgtkMotionNotifyEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "button-press-event", G_CALLBACK(iupgtkButtonEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "button-release-event",G_CALLBACK(iupgtkButtonEvent), ih);
  }

  /* add to the parent, all GTK controls must call this. */
  iupgtkBaseAddToParent(ih);

  if (scrolled_window)
    gtk_widget_realize((GtkWidget*)scrolled_window);
  gtk_widget_realize(ih->handle);

  /* configure for DRAG&DROP */
  if (IupGetCallback(ih, "DROPFILES_CB"))
    iupAttribSetStr(ih, "DRAGDROP", "YES");

  iupListSetInitialItems(ih);

  return IUP_NOERROR;
}
Example #4
0
GtkWidget * gw_window_box_about_create ( GtkWindow *window)
{
        /* This window must be single, this property shouldn't be changed */
        static GtkWidget *w = NULL;
        GdkColor transparent = {0};
        GtkWidget *vbox_about = NULL;
        GtkWidget *label = NULL;
        GtkWidget *event_box = NULL;
        GtkWidget *logo = NULL;
	GdkPixmap *pix_gw_logo = NULL;
	GdkBitmap *msk_gw_logo = NULL;
        gchar * text = NULL;
        gchar * text_utf8 = NULL;
        GdkCursor *cursor = NULL;
        gchar * os_version = NULL;


#ifdef GW_DEBUG_GUI_COMPONENT
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

        if ( !w )
        {
	        /* GWhere logo loading */
	        pix_gw_logo = gdk_pixmap_create_from_xpm_d ( GTK_WIDGET ( window)->window, &msk_gw_logo, &transparent, GWhere_logo_xpm);

                w = gtk_window_new ( GTK_WINDOW_TOPLEVEL);

                gtk_window_set_modal ( GTK_WINDOW ( w), TRUE);
                gtk_window_set_transient_for ( GTK_WINDOW ( w), window);
                gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER);
                g_strdup_to_gtk_text ( _( "About"), text_utf8);
                gtk_window_set_title ( GTK_WINDOW ( w), text_utf8);
                g_free ( text_utf8);

                gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gw_window_box_about_destroy), &w);
                gtk_signal_connect ( GTK_OBJECT ( w), "delete-event", GTK_SIGNAL_FUNC ( gtk_widget_destroy), NULL);

		/* See more bottom the call of gdk_pixmap_unref() and gdk_bitmap_unref().
		gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_WINDOW_ABOUT_LOGO_PIX, pix_gw_logo, ( GtkDestroyNotify)gdk_pixmap_unref);
		gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_WINDOW_ABOUT_LOGO_BIT, msk_gw_logo, ( GtkDestroyNotify)gdk_bitmap_unref);
		*/

                gtk_container_set_border_width ( GTK_CONTAINER ( w), 5);
                gtk_widget_set_usize ( w, 360, 340);

                event_box = gtk_event_box_new ( );
                gtk_container_add ( GTK_CONTAINER ( w), event_box);

                vbox_about = gtk_vbox_new ( FALSE, 0);
                gtk_container_add ( GTK_CONTAINER ( event_box), vbox_about);

                logo = gtk_pixmap_new ( pix_gw_logo, msk_gw_logo);
		gdk_pixmap_unref ( pix_gw_logo);
		gdk_bitmap_unref ( msk_gw_logo);
                gtk_container_add ( GTK_CONTAINER ( vbox_about), logo);

		/* Doesn't encode to UTF-8 substring because the result string will be encoded. */
		gw_os_get_version_str ( &os_version);
                text = g_strconcat ( PROJECT_NAME,
                                "-",
                                VERSION,
                                _( "\nRemovable media catalog management\nBy Sebastien LECACHEUR\n\[email protected]\nhttp://www.gwhere.org\n"),
                                _( "GWhere allows you to manage a database of your CDs and other removable media (hard disks, floppy drive, Zip drive, CD- ROM, etc...). With GWhere it's easy to browse your CDs or to make a quick search without needing to insert all of your CDs in the drive and search them one by one."),
                                _( "\n\nRuns under "),
                                os_version,
                                NULL);
                if ( os_version != NULL )
                {
                	g_free ( os_version);
                }

		g_strdup_to_gtk_text ( text, text_utf8);
                g_free ( text);

                label = gtk_label_new ( text_utf8);
                g_free ( text_utf8);
                gtk_label_set_justify ( GTK_LABEL ( label), GTK_JUSTIFY_FILL);
                gtk_label_set_line_wrap ( GTK_LABEL ( label), TRUE);
                gtk_container_add ( GTK_CONTAINER ( vbox_about), label);

		/* Should it be mandatory? Yes, in order to get the good window size
		   to displaying all informations. */
		gtk_widget_set_usize ( label, 330, 280);

		gtk_widget_set_events ( event_box, GDK_BUTTON_PRESS_MASK);
		gtk_signal_connect_object ( GTK_OBJECT ( event_box), "button_press_event", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w));

		if ( (cursor = gdk_cursor_new ( GDK_HAND2)) != NULL)
		{
	                /* Fix bug : event_box->window is NULL with GTK-2.0. */
			if ( GTK_WIDGET ( event_box)->window != NULL )
			{
                		gdk_window_set_cursor ( GTK_WIDGET ( event_box)->window, cursor);
#ifdef HAVE_GTK20
                		gdk_cursor_unref ( cursor);
#endif
                	}
                	else
                	{
#ifdef GW_DEBUG_GUI_COMPONENT
                		g_warning ( "gtk_event_box->window is NULL!!");
#endif
                		gdk_cursor_destroy ( cursor);
                	}
                }
        }

        if ( !GTK_WIDGET_VISIBLE ( w) )
        {
#ifdef GW_DEBUG_GUI_COMPONENT
                g_print ( "*** GW - %s (%d) :: %s() : show the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

                gtk_widget_show_all ( w);
        }
        else
        {
#ifdef GW_DEBUG_GUI_COMPONENT
        g_print ( "*** GW - %s (%d) :: %s() : destroy the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

		g_warning ( "gw_window_box_about is already displayed!! Destroying it...");

                gtk_widget_destroy ( w);
        }

        return w;
}
Example #5
0
gboolean applet_main (MyPanelApplet *applet_widget, const gchar *iid, gpointer data) {
	streamer_applet *applet;
	char *zErrMsg;
	int res, i;
	char ui[24576];

	if (strcmp (iid, APPLET_ID) != 0) 
		return FALSE;

	// i18n
	setlocale (LC_ALL, "");
	bindtextdomain (PACKAGE_NAME, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE_NAME, "utf-8");
	textdomain (PACKAGE_NAME);

	// Init 
	applet = g_malloc0(sizeof(streamer_applet));
	applet->applet = applet_widget;
	memset(&applet->xml_listen_url[0], '\0', 1024);
	memset(&applet->xml_bitrate[0], '\0', 1024);
	memset(&applet->xml_server_name[0], '\0', 1024);
	memset(&applet->xml_genre[0], '\0', 1024);
	memset(&applet->url[0], '\0', 1024);	
	memset(&applet->ui_fav[0], '\0', 10240);
	memset(&applet->ui_recent[0], '\0', 10240);
	applet->timestamp = time(NULL);
	applet->xml_curr_entries = 0;
	applet->icecast_total_entries = 0;
	applet->status = 0;

	for (i=0; i<10; i++) {
		memset(&applet->hash_fav[i].hash[0], '\0', 64);
		memset(&applet->hash_recent[i].hash[0], '\0', 64);
	}

	applet->settings.show_notifications = 0;
	applet->settings.duration_notifications = 5;

#ifdef HAVE_GNOME_2
	applet->bonobo_counter = 0;
#endif

	// Check home dir, copy skel database
	char applet_home_dir[1024], skel_file[1024], local_file[1024];
	struct stat stat_buf;
	struct passwd *pw = getpwuid(getuid());
	sprintf(&applet_home_dir[0], "%s/%s", pw->pw_dir, APPLET_HOME_DIR);
	int stat_res = stat(&applet_home_dir[0], &stat_buf);
	int errsv = errno;
	if ((stat_res == 0) && (!S_ISDIR(stat_buf.st_mode))){
			push_notification(_("Streamer Applet Error"), _("Cannot access configuration directory. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
			return FALSE;
	}
	else if (stat_res == -1) {
		if (errsv == ENOENT) {
			int mkdir_res = mkdir(&applet_home_dir[0], 0755);
			if (mkdir_res == 1) {
				push_notification(_("Streamer Applet Error"), _("Cannot create configuration directory. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
				return FALSE;
			}
		}
		else {
			push_notification(_("Streamer Applet Error"), _("Cannot verify configuration directory. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
			return FALSE;
		}
	}
	sprintf(&skel_file[0], "%s/%s", APPLET_SKEL_PATH, APPLET_SQLITE_DB_FILENAME);
	sprintf(&local_file[0], "%s/%s/%s", pw->pw_dir, APPLET_HOME_DIR, APPLET_SQLITE_DB_FILENAME);
	stat_res = stat(&local_file[0], &stat_buf);
	errsv = errno;
	if ((stat_res == 0) && (!S_ISREG(stat_buf.st_mode))){
		push_notification(_("Streamer Applet Error"), _("Database file is not a regular file. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
	}
	else if (stat_res == -1) {
		if (errsv == ENOENT) {
			if (!cp(&local_file[0], &skel_file[0])) {
				push_notification(_("Streamer Applet Error"), _("Cannot copy database file to configuration directory. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
				return FALSE;
			}
		}
		else {
			push_notification(_("Streamer Applet Error"), _("Cannot verify database file. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
			return FALSE;
		}
	}
	
	// Test DB connection, upgrade DB if necessary
	if (!sqlite_connect(applet)) {
		push_notification(_("Streamer Applet Error"), _("Unable to connect to DB. Exiting."), NULL, DEFAULT_NOTIFICATION_DURATION);
		return FALSE;
	}

	zErrMsg = 0;
	res = sqlite3_exec(applet->sqlite, "SELECT version FROM version", cb_sql_version, (void*) applet, &zErrMsg);
	if (res != SQLITE_OK) {
		push_notification(_("Streamer Applet Error"), zErrMsg, NULL, DEFAULT_NOTIFICATION_DURATION);
		sqlite3_free(zErrMsg);
		return FALSE;
	}

	if (applet->db_version == 1) {
		// Upgrade DB to version 2
		sqlite_insert(applet, "CREATE TABLE custom_stations (server_name VARCHAR(255), listen_url VARCHAR(255), bitrate VARCHAR(255), genre VARCHAR(255))");
		sqlite_insert(applet, "ALTER TABLE stations RENAME TO icecast_stations");
		sqlite_insert(applet, "UPDATE version SET version=2");
	}
	else if (applet->db_version == 2) {
		// Upgrade DB to version 3
		sqlite_insert(applet, "CREATE TABLE rbrowser_stations (server_name VARCHAR(255), listen_url VARCHAR(255), bitrate VARCHAR(255), genre VARCHAR(255))");
		sqlite_insert(applet, "UPDATE version SET version=3");
	}

	sqlite3_close(applet->sqlite);

	// Init GStreamer
	gstreamer_init(applet);

	// Get an image
	char image_file[1024];
	sprintf(&image_file[0], "%s/%s", APPLET_ICON_PATH, APPLET_ICON_PAUSE);
	applet->image = gtk_image_new_from_file (&image_file[0]);

	// Put the image into a container (it needs to receive actions)
	applet->event_box = gtk_event_box_new();
	gtk_container_add (GTK_CONTAINER (applet->event_box), applet->image);

	// Put the container into the applet
	gtk_container_add (GTK_CONTAINER (applet->applet), applet->event_box);

	// Define menu action group
#ifdef HAVE_MATE
	applet->action_group = gtk_action_group_new ("Streamer_Applet_Actions");
	gtk_action_group_set_translation_domain(applet->action_group, PACKAGE_NAME);
	gtk_action_group_add_actions (applet->action_group, applet_menu_actions_mate, G_N_ELEMENTS (applet_menu_actions_mate), applet);
#endif

	// Get last 10 entried from Recent & Fav, then fetch last URL
	if (!sqlite_connect(applet))
		return FALSE;

	zErrMsg = 0;
	memset(&applet->ui_recent[0], '\0', 1);

	res = sqlite3_exec(applet->sqlite, "SELECT server_name, listen_url FROM recent GROUP BY listen_url ORDER BY unix_timestamp DESC LIMIT 10", cb_sql_recent_10, (void*) applet, &zErrMsg);
	if (res != SQLITE_OK) {
		push_notification(_("Streamer Applet Error"), zErrMsg, NULL, DEFAULT_NOTIFICATION_DURATION);
		sqlite3_free(zErrMsg);
		return FALSE;
	}

	memset(&applet->ui_fav[0], '\0', 1);
	res = sqlite3_exec(applet->sqlite, "SELECT server_name, listen_url FROM favourites LIMIT 10", cb_sql_fav_10, (void*) applet, &zErrMsg);
	if (res != SQLITE_OK) {
		push_notification(_("Streamer Applet Error"), zErrMsg, NULL, DEFAULT_NOTIFICATION_DURATION);
		sqlite3_free(zErrMsg);
		return FALSE;
	}

	res = sqlite3_exec(applet->sqlite, "SELECT * FROM recent ORDER BY unix_timestamp DESC LIMIT 1", cb_sql_recent, (void*) applet, &zErrMsg);
	if (res != SQLITE_OK) {
		push_notification(_("Streamer Applet Error"), zErrMsg, NULL, DEFAULT_NOTIFICATION_DURATION);
		sqlite3_free(zErrMsg);
		return FALSE;
	}

	sqlite3_free(zErrMsg);
	sqlite3_close(applet->sqlite);

	// Build menu
	sprintf(&ui[0], "%s %s %s %s %s", ui1, &applet->ui_recent[0], ui2, &applet->ui_fav[0], ui3);
#ifdef HAVE_MATE
	mate_panel_applet_setup_menu(applet->applet, &ui[0], applet->action_group);
#elif HAVE_GNOME_2
	BonoboUIVerb bnb1 = BONOBO_UI_UNSAFE_VERB ("All", G_CALLBACK (menu_cb_all));
	applet->applet_menu_actions_gnome[applet->bonobo_counter] = bnb1;
	applet->bonobo_counter++;
	BonoboUIVerb bnb1a = BONOBO_UI_UNSAFE_VERB ("Settings", G_CALLBACK (menu_cb_settings));
	applet->applet_menu_actions_gnome[applet->bonobo_counter] = bnb1a;
	applet->bonobo_counter++;
	BonoboUIVerb bnb2 = BONOBO_UI_UNSAFE_VERB ("About", G_CALLBACK (menu_cb_about));
	applet->applet_menu_actions_gnome[applet->bonobo_counter] = bnb2;
	applet->bonobo_counter++;
	BonoboUIVerb bnb3 = BONOBO_UI_VERB_END;
	applet->applet_menu_actions_gnome[applet->bonobo_counter] = bnb3;
	applet->bonobo_counter++;
	panel_applet_setup_menu(applet->applet, &ui[0], applet->applet_menu_actions_gnome, applet);
#endif

	// Merge menu
	//GError **error;
	//char ui[10240];
	//sprintf(&ui[0], "<menu action='SubMenu1'>\n<menuitem action='All'/>\n<menuitem action='All'/></menu>");
	//guint merge_id = gtk_ui_manager_add_ui_from_string (applet->applet->priv->ui_manager, &ui[0], -1, error);

	// Settings: Prepare DConf - GNOME2 only
#ifdef HAVE_GNOME_2
	if (!panel_applet_gconf_get_bool(PANEL_APPLET(applet->applet), "have_settings", NULL)) {
		panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "have_settings", TRUE, NULL);
		panel_applet_gconf_set_int(PANEL_APPLET(applet->applet), APPLET_KEY_OPTION_1, 0, NULL);
		panel_applet_gconf_set_int(PANEL_APPLET(applet->applet), APPLET_KEY_OPTION_2, 5, NULL);
	}
#endif

	// Load settings
#ifdef HAVE_MATE
	applet->gsettings = g_settings_new_with_path(APPLET_GSETTINGS_SCHEMA, APPLET_GSETTINGS_PATH);
	applet->settings.show_notifications = g_settings_get_int(applet->gsettings, APPLET_KEY_OPTION_1);
	applet->settings.duration_notifications = g_settings_get_int(applet->gsettings, APPLET_KEY_OPTION_2);
#elif HAVE_GNOME_2
	applet->settings.show_notifications = panel_applet_gconf_get_int(PANEL_APPLET(applet->applet), APPLET_KEY_OPTION_1, NULL);
	applet->settings.duration_notifications = panel_applet_gconf_get_int(PANEL_APPLET(applet->applet), APPLET_KEY_OPTION_2, NULL);
#endif

	// Signals
	g_signal_connect(G_OBJECT(applet->event_box), "button_press_event", G_CALLBACK (on_left_click), (gpointer)applet);
	g_signal_connect(G_OBJECT(applet->applet), "change_background", G_CALLBACK (applet_back_change), (gpointer)applet);
	g_signal_connect(G_OBJECT(applet->applet), "destroy", G_CALLBACK(applet_destroy), (gpointer)applet);

	// Tooltip
	gtk_widget_set_tooltip_text (GTK_WIDGET (applet->applet), _("No stream selected. Right-click to load one."));

	// Show applet
	gtk_widget_show_all (GTK_WIDGET (applet->applet));

	// Run
	applet->loop = g_main_loop_new (NULL, FALSE);
	g_main_loop_run (applet->loop);

	return TRUE;
}
GtkWidget*
create_rs232 (void)
{
  GtkWidget *rs232;
  GtkWidget *eventbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox5;
  GtkWidget *exit;
  GtkWidget *swap;
  GtkWidget *clean_data_area;
  GtkWidget *label7;
  GtkWidget *label8;
  GtkWidget *hseparator5;
  GtkWidget *hbox3;
  GtkWidget *vbox2;
  GtkWidget *hbox18;
  GtkWidget *label1;
  GtkWidget *combo1;
  GList *combo1_items = NULL;
  GtkWidget *combo_entry_baudrate;
  GtkWidget *hbox24;
  GtkWidget *label2;
  GtkWidget *entry5;
  GtkWidget *label20;
  GtkWidget *hbox19;
  GtkWidget *label3;
  GtkWidget *hbox25;
  GtkWidget *combo3;
  GList *combo3_items = NULL;
  GtkWidget *combo_entry_port;
  GtkWidget *hbox26;
  GtkWidget *label4;
  GtkWidget *entry2;
  GtkWidget *label21;
  GtkWidget *hbox27;
  GtkWidget *togglebutton1;
  GtkWidget *save_as_numeral;
  GtkWidget *entry1;
  GtkWidget *scrolledwindow1;
  GtkWidget *text1;
  GtkWidget *scrolledwindow2;
  GtkWidget *text2;
  GtkWidget *hseparator4;
  GtkWidget *hbox4;
  GtkWidget *label22;
  GSList *_4_group = NULL;
  GtkWidget *radiobutton1;
  guint radiobutton2_key;
  GtkWidget *radiobutton2;
  GtkWidget *hseparator6;
  GtkWidget *hbox29;
  GtkWidget *spectrum;
  GtkWidget *inspect;
  GtkWidget *hbox30;
  GtkWidget *big_spectrum;
  GtkWidget *optionmenu1;
  GtkWidget *optionmenu1_menu;
  GtkWidget *glade_menuitem;
  GtkWidget *print_spectrum;
  GtkWidget *label19;
  GtkWidget *printer_name;
  GtkWidget *hbox17;
  GtkWidget *label18;
  GtkWidget *point;
  GtkWidget *save_as_eps;
  GtkWidget *entry4;
  GtkWidget *hseparator1;
  GtkWidget *hbox9;
  GtkWidget *label9;
  GSList *_1_group = NULL;
  GtkWidget *specification_on;
  GtkWidget *coefficient_on;
  GtkWidget *hseparator3;
  GtkWidget *hbox6;
  GtkWidget *label11;
  GSList *_2_group = NULL;
  GtkWidget *move_average;
  GtkWidget *window;
  GtkWidget *butterworth;
  GtkWidget *chebyshev;
  GtkWidget *hbox8;
  GtkWidget *fs_label;
  GtkWidget *fs;
  GtkWidget *pass_edge_label;
  GtkWidget *pass_edge;
  GtkWidget *stop_edge_label;
  GtkWidget *stop_edge;
  GtkWidget *pass_ripple_label;
  GtkWidget *pass_ripple;
  GtkWidget *stop_ripple_label;
  GtkWidget *stop_ripple;
  GtkWidget *hseparator2;
  GtkWidget *hbox10;
  GtkWidget *label12;
  GSList *_3_group = NULL;
  GtkWidget *fir_input_coefficient;
  GtkWidget *iir_input_coefficient;
  GtkWidget *identify_stability;
  GtkWidget *hbox14;
  GtkWidget *label16;
  GtkWidget *a_value;
  GtkWidget *label17;
  GtkWidget *b_value;
  GtkWidget *appbar1;
  GtkWidget *hbox28;
  GtkWidget *statusbar1;
  GtkWidget *progressbar1;
  GtkAccelGroup *accel_group;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  accel_group = gtk_accel_group_new ();

  rs232 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (rs232), "rs232", rs232);
  gtk_window_set_title (GTK_WINDOW (rs232), _("\246\263\255\255\257\337\275\304\305T\300\263 FIR \244\316\265L\255\255\257\337\275\304\305T\300\263 IIR \252\272\300W\303\320\244\300\252R\300\263\245\316"));
  gtk_window_set_policy (GTK_WINDOW (rs232), FALSE, FALSE, TRUE);

  eventbox1 = gtk_event_box_new ();
  gtk_widget_ref (eventbox1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "eventbox1", eventbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (eventbox1);
  gtk_container_add (GTK_CONTAINER (rs232), eventbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (eventbox1), vbox1);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox5);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox5", hbox5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox5);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox5, TRUE, TRUE, 10);

  exit = gtk_button_new_with_label (_("\302\367\266}"));
  gtk_widget_ref (exit);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "exit", exit,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (exit);
  gtk_box_pack_start (GTK_BOX (hbox5), exit, FALSE, FALSE, 10);
  gtk_widget_set_usize (exit, 100, -2);

  swap = gtk_button_new_with_label (_("\261\265\246\254"));
  gtk_widget_ref (swap);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "swap", swap,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (swap);
  gtk_box_pack_start (GTK_BOX (hbox5), swap, FALSE, FALSE, 10);
  gtk_widget_set_usize (swap, 100, -2);
  gtk_tooltips_set_tip (tooltips, swap, _("\245i\261\265\246\254\245\321\246\352\246C\260\360\251\322\260e\250\323\252\272\270\352\256\306"), NULL);

  clean_data_area = gtk_button_new_with_label (_("\262M\260\243\270\352\256\306\261\265\246\254\260\317"));
  gtk_widget_ref (clean_data_area);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "clean_data_area", clean_data_area,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (clean_data_area);
  gtk_box_pack_start (GTK_BOX (hbox5), clean_data_area, FALSE, FALSE, 10);

  label7 = gtk_label_new (_("\255\354\251l\270\352\256\306"));
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox5), label7, FALSE, FALSE, 89);

  label8 = gtk_label_new (_("\274\306\255\310\270\352\256\306"));
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 52);

  hseparator5 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator5);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator5", hseparator5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator5);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator5, TRUE, TRUE, 5);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox3);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox3", hbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox3);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox3, TRUE, TRUE, 5);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "vbox2", vbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (hbox3), vbox2, TRUE, TRUE, 0);

  hbox18 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox18);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox18", hbox18,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox18);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox18, TRUE, TRUE, 5);

  label1 = gtk_label_new (_("\266\307\277\351\300j\262v"));
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox18), label1, FALSE, FALSE, 10);

  combo1 = gtk_combo_new ();
  gtk_widget_ref (combo1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "combo1", combo1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo1);
  gtk_box_pack_start (GTK_BOX (hbox18), combo1, TRUE, TRUE, 10);
  gtk_widget_set_usize (combo1, 1, -2);
  combo1_items = g_list_append (combo1_items, (gpointer) _("2400"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("4800"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("9600"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("19200"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("38400"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("57600"));
  combo1_items = g_list_append (combo1_items, (gpointer) _("115200"));
  gtk_combo_set_popdown_strings (GTK_COMBO (combo1), combo1_items);
  g_list_free (combo1_items);

  combo_entry_baudrate = GTK_COMBO (combo1)->entry;
  gtk_widget_ref (combo_entry_baudrate);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "combo_entry_baudrate", combo_entry_baudrate,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_entry_baudrate);
  gtk_entry_set_editable (GTK_ENTRY (combo_entry_baudrate), FALSE);
  gtk_entry_set_text (GTK_ENTRY (combo_entry_baudrate), _("4800"));

  hbox24 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox24);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox24", hbox24,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox24);
  gtk_box_pack_start (GTK_BOX (hbox18), hbox24, TRUE, TRUE, 0);

  label2 = gtk_label_new (_("\270\352\256\306\252\370\253\327"));
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox24), label2, FALSE, FALSE, 15);

  entry5 = gtk_entry_new ();
  gtk_widget_ref (entry5);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "entry5", entry5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry5);
  gtk_box_pack_start (GTK_BOX (hbox24), entry5, TRUE, TRUE, 10);
  gtk_widget_set_usize (entry5, 1, -2);
  gtk_tooltips_set_tip (tooltips, entry5, _("\263\346\246\354\254O\246\354\244\270\262\325"), NULL);
  gtk_entry_set_text (GTK_ENTRY (entry5), _("16"));

  label20 = gtk_label_new (_("\246\354\244\270\262\325\274\306"));
  gtk_widget_ref (label20);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label20", label20,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label20);
  gtk_box_pack_start (GTK_BOX (hbox24), label20, FALSE, FALSE, 10);

  hbox19 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox19);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox19", hbox19,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox19);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox19, TRUE, TRUE, 5);

  label3 = gtk_label_new (_("\266\307\277\351\247\307\246C"));
  gtk_widget_ref (label3);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label3", label3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label3);
  gtk_box_pack_start (GTK_BOX (hbox19), label3, FALSE, FALSE, 10);

  hbox25 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox25);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox25", hbox25,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox25);
  gtk_box_pack_start (GTK_BOX (hbox19), hbox25, TRUE, TRUE, 0);

  combo3 = gtk_combo_new ();
  gtk_widget_ref (combo3);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "combo3", combo3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo3);
  gtk_box_pack_start (GTK_BOX (hbox25), combo3, TRUE, TRUE, 10);
  gtk_widget_set_usize (combo3, 1, -2);
  combo3_items = g_list_append (combo3_items, (gpointer) _("1"));
  combo3_items = g_list_append (combo3_items, (gpointer) _("2"));
  gtk_combo_set_popdown_strings (GTK_COMBO (combo3), combo3_items);
  g_list_free (combo3_items);

  combo_entry_port = GTK_COMBO (combo3)->entry;
  gtk_widget_ref (combo_entry_port);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "combo_entry_port", combo_entry_port,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_entry_port);
  gtk_entry_set_editable (GTK_ENTRY (combo_entry_port), FALSE);
  gtk_entry_set_text (GTK_ENTRY (combo_entry_port), _("1"));

  hbox26 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox26);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox26", hbox26,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox26);
  gtk_box_pack_start (GTK_BOX (hbox25), hbox26, TRUE, TRUE, 0);

  label4 = gtk_label_new (_("\270\352\256\306\301`\274\306"));
  gtk_widget_ref (label4);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label4", label4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (hbox26), label4, FALSE, FALSE, 15);

  entry2 = gtk_entry_new ();
  gtk_widget_ref (entry2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "entry2", entry2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry2);
  gtk_box_pack_start (GTK_BOX (hbox26), entry2, TRUE, TRUE, 10);
  gtk_widget_set_usize (entry2, 1, -2);
  gtk_entry_set_text (GTK_ENTRY (entry2), _("5"));

  label21 = gtk_label_new (_("\265\247\270\352\256\306\274\306"));
  gtk_widget_ref (label21);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label21", label21,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label21);
  gtk_box_pack_start (GTK_BOX (hbox26), label21, FALSE, FALSE, 10);

  hbox27 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox27);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox27", hbox27,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox27);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox27, FALSE, FALSE, 5);

  togglebutton1 = gtk_toggle_button_new_with_label (_("\261j\250\356\274g\244J\300\311\256\327"));
  gtk_widget_ref (togglebutton1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "togglebutton1", togglebutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (togglebutton1);
  gtk_box_pack_start (GTK_BOX (hbox27), togglebutton1, FALSE, FALSE, 10);
  gtk_tooltips_set_tip (tooltips, togglebutton1, _("\244\243\272\336\253\374\251w\252\272\300\311\256\327\270\364\256|\244\247\300\311\246W\246s\246b\273P\247_\241A\244@\253\337\261j\250\356\274g\244J"), NULL);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton1), TRUE);

  save_as_numeral = gtk_button_new_with_label (_("\300\311\256\327\270\364\256|"));
  gtk_widget_ref (save_as_numeral);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "save_as_numeral", save_as_numeral,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (save_as_numeral);
  gtk_box_pack_start (GTK_BOX (hbox27), save_as_numeral, FALSE, FALSE, 0);

  entry1 = gtk_entry_new ();
  gtk_widget_ref (entry1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "entry1", entry1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry1);
  gtk_box_pack_start (GTK_BOX (hbox27), entry1, TRUE, TRUE, 10);
  gtk_widget_set_usize (entry1, 1, -2);
  gtk_entry_set_text (GTK_ENTRY (entry1), _("/home/allways/numeral.txt"));

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "scrolledwindow1", scrolledwindow1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow1, TRUE, TRUE, 5);
  gtk_widget_set_usize (scrolledwindow1, 1, -2);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);

  text1 = gtk_text_new (NULL, NULL);
  gtk_widget_ref (text1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "text1", text1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (text1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), text1);
  gtk_tooltips_set_tip (tooltips, text1, _("\261q\246\352\246C\260\360\266\307\250\323\252\272\247\271\276\343\270\352\256\306"), NULL);

  scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "scrolledwindow2", scrolledwindow2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow2);
  gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow2, TRUE, TRUE, 5);
  gtk_widget_set_usize (scrolledwindow2, 1, -2);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);

  text2 = gtk_text_new (NULL, NULL);
  gtk_widget_ref (text2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "text2", text2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (text2);
  gtk_container_add (GTK_CONTAINER (scrolledwindow2), text2);
  gtk_tooltips_set_tip (tooltips, text2, _("\261q\247\271\276\343\270\352\256\306\251\322\261o\250\354\252\272\257\302\274\306\255\310\270\352\256\306"), NULL);

  hseparator4 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator4);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator4", hseparator4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator4);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator4, TRUE, TRUE, 5);

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox4);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox4", hbox4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox4, TRUE, TRUE, 5);

  label22 = gtk_label_new (_("\250\317\245\316\245\273\263n\305\351\244\247\302o\252i\276\271"));
  gtk_widget_ref (label22);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label22", label22,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label22);
  gtk_box_pack_start (GTK_BOX (hbox4), label22, FALSE, FALSE, 10);

  radiobutton1 = gtk_radio_button_new_with_label (_4_group, _("\254O"));
  _4_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1));
  gtk_widget_ref (radiobutton1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "radiobutton1", radiobutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton1);
  gtk_box_pack_start (GTK_BOX (hbox4), radiobutton1, FALSE, FALSE, 0);

  radiobutton2 = gtk_radio_button_new_with_label (_4_group, "");
  radiobutton2_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (radiobutton2)->child),
                                   _("\247_"));
  gtk_widget_add_accelerator (radiobutton2, "clicked", accel_group,
                              radiobutton2_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  _4_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2));
  gtk_widget_ref (radiobutton2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "radiobutton2", radiobutton2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton2);
  gtk_box_pack_start (GTK_BOX (hbox4), radiobutton2, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton2), TRUE);

  hseparator6 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator6);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator6", hseparator6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator6);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator6, TRUE, TRUE, 5);

  hbox29 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox29);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox29", hbox29,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox29);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox29, TRUE, TRUE, 5);

  spectrum = gtk_button_new_with_label (_("\266}\251l\303\270\273s\302o\252i\276\271\300W\303\320\271\317"));
  gtk_widget_ref (spectrum);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "spectrum", spectrum,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spectrum);
  gtk_box_pack_start (GTK_BOX (hbox29), spectrum, FALSE, FALSE, 10);
  gtk_tooltips_set_tip (tooltips, spectrum, _("\267\355\246U\260\321\274\306\244\316\263]\251w\246n\244F\244\247\253\341\241A\264N\245i\245H\253\366\246\271\266s\250\323\303\270\273s\271\317\247\316\244F"), NULL);

  inspect = gtk_button_new_with_label (_("\300\313\265\370\271\317\300\311"));
  gtk_widget_ref (inspect);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "inspect", inspect,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (inspect);
  gtk_box_pack_start (GTK_BOX (hbox29), inspect, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, inspect, _("\245i\244\243\254O A \271\317\263\341\241I\254O\300W\303\320\271\317\260\325\241I"), NULL);

  hbox30 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox30);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox30", hbox30,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox30);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox30, TRUE, TRUE, 5);

  big_spectrum = gtk_toggle_button_new_with_label (_("\244j\261i\252\272\300W\303\320\271\317"));
  gtk_widget_ref (big_spectrum);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "big_spectrum", big_spectrum,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (big_spectrum);
  gtk_box_pack_start (GTK_BOX (hbox30), big_spectrum, FALSE, FALSE, 10);

  optionmenu1 = gtk_option_menu_new ();
  gtk_widget_ref (optionmenu1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "optionmenu1", optionmenu1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (optionmenu1);
  gtk_box_pack_start (GTK_BOX (hbox30), optionmenu1, FALSE, FALSE, 10);
  optionmenu1_menu = gtk_menu_new ();
  glade_menuitem = gtk_menu_item_new_with_label (_("          \300W\303\320\271\317\252\355\245\334\244\350\252k"));
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem);
  glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\274\306\246\354\300W\262v Y\241G\275u\251\312\274W\257q"));
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem);
  glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\274\306\246\354\300W\262v Y\241G\244\300\250\251\274W\257q"));
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem);
  glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\303\376\244\361\300W\262v Y\241G\275u\251\312\274W\257q"));
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem);
  glade_menuitem = gtk_menu_item_new_with_label (_("X \266b\241G\303\376\244\361\300W\262v Y\241G\244\300\250\251\274W\257q"));
  gtk_widget_show (glade_menuitem);
  gtk_menu_append (GTK_MENU (optionmenu1_menu), glade_menuitem);
  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu1), optionmenu1_menu);

  print_spectrum = gtk_toggle_button_new_with_label (_("\300W\303\320\271\317\245\316\246L\252\355\276\367\246L\245X"));
  gtk_widget_ref (print_spectrum);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "print_spectrum", print_spectrum,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (print_spectrum);
  gtk_box_pack_start (GTK_BOX (hbox30), print_spectrum, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, print_spectrum, _("\300W\303\320\271\317\273\335\255n\245\316\246L\252\355\276\367\303\270\273s\245X\250\323\252\272\256\311\255\324\241A\250\317\244\247\244U\250H\241A\260O\261o\246L\252\355\276\367\252\272\246W\272\331\255n\245[\263\341\241I"), NULL);

  label19 = gtk_label_new (_("\246L\252\355\276\367\252\272\271q\270\243\246W\272\331"));
  gtk_widget_ref (label19);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label19", label19,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label19);
  gtk_box_pack_start (GTK_BOX (hbox30), label19, FALSE, FALSE, 10);

  printer_name = gtk_entry_new ();
  gtk_widget_ref (printer_name);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "printer_name", printer_name,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (printer_name);
  gtk_box_pack_start (GTK_BOX (hbox30), printer_name, TRUE, TRUE, 10);
  gtk_widget_set_usize (printer_name, 1, -2);
  gtk_tooltips_set_tip (tooltips, printer_name, _("\264N\254O\246b\272\364\270\364\244W\246L\252\355\276\367\252\272\246W\246r\241A\245i\244\243\254O\245L\252\272\241\247\262\243\253~\246W\246r\241\250\263\341"), NULL);
  gtk_entry_set_text (GTK_ENTRY (printer_name), _("hp"));

  hbox17 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox17);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox17", hbox17,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox17);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox17, TRUE, TRUE, 5);

  label18 = gtk_label_new (_("\300W\303\320\271\317\245\255\267\306\253\327( X \266b )"));
  gtk_widget_ref (label18);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label18", label18,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label18);
  gtk_box_pack_start (GTK_BOX (hbox17), label18, FALSE, FALSE, 10);

  point = gtk_entry_new ();
  gtk_widget_ref (point);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "point", point,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (point);
  gtk_box_pack_start (GTK_BOX (hbox17), point, TRUE, TRUE, 0);
  gtk_widget_set_usize (point, 1, -2);
  gtk_tooltips_set_tip (tooltips, point, _("\264N\254O\247A\247\306\261\346 X \266b\257\340\260\367\244\300\246\250\264X\255\323\265\245\244\300\251O\241H"), NULL);
  gtk_entry_set_text (GTK_ENTRY (point), _("200"));

  save_as_eps = gtk_button_new_with_label (_("eps\241Bps\241Bpdf \300\311\300x\246s\270\364\256|\241A\275\320\245[\244W\260\306\300\311\246W"));
  gtk_widget_ref (save_as_eps);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "save_as_eps", save_as_eps,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (save_as_eps);
  gtk_box_pack_start (GTK_BOX (hbox17), save_as_eps, FALSE, FALSE, 10);

  entry4 = gtk_entry_new ();
  gtk_widget_ref (entry4);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "entry4", entry4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry4);
  gtk_box_pack_start (GTK_BOX (hbox17), entry4, TRUE, TRUE, 10);
  gtk_widget_set_usize (entry4, 1, -2);
  gtk_tooltips_set_tip (tooltips, entry4, _("\275\320\260O\261o\244@\251w\261o\247\342\271\317\300\311\252\272\260\306\300\311\246W\246\333\246\346\245[\244J\241C\246p eps ps pdf"), NULL);
  gtk_entry_set_text (GTK_ENTRY (entry4), _("/home/allways/spectrum.eps"));

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator1", hseparator1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 5);

  hbox9 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox9);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox9", hbox9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox9);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox9, TRUE, TRUE, 5);

  label9 = gtk_label_new (_("\302o\252i\276\271\252\272\300W\303\320\271\317\262\243\245\315\244\350\246\241\241G"));
  gtk_widget_ref (label9);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label9", label9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label9);
  gtk_box_pack_start (GTK_BOX (hbox9), label9, FALSE, FALSE, 5);

  specification_on = gtk_radio_button_new_with_label (_1_group, _("\302o\252i\276\271\251\372\262\323\263W\256\346"));
  _1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (specification_on));
  gtk_widget_ref (specification_on);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "specification_on", specification_on,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (specification_on);
  gtk_box_pack_start (GTK_BOX (hbox9), specification_on, FALSE, FALSE, 5);
  gtk_tooltips_set_tip (tooltips, specification_on, _("\247A\245i\245H\246\333\246\346\245\321\302o\252i\276\271\252\272\246U\255\323\260\321\274\306\244@\244@\277\351\244J\247A\255n\252\272\300W\261a\275d\263\362"), NULL);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (specification_on), TRUE);

  coefficient_on = gtk_radio_button_new_with_label (_1_group, _("\260\262\263]\244\247\253Y\274\306\261a\244J\302\340\262\276\250\347\246\241"));
  _1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (coefficient_on));
  gtk_widget_ref (coefficient_on);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "coefficient_on", coefficient_on,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (coefficient_on);
  gtk_box_pack_start (GTK_BOX (hbox9), coefficient_on, FALSE, FALSE, 5);
  gtk_tooltips_set_tip (tooltips, coefficient_on, _("\247A\245i\245H\245\321\265\352\300\300\244@\255\323\302\340\262\276\250\347\274\306\252\272\253Y\274\306\250\323\261o\250\354\247A\255n\252\272\300W\303\320\271\317\241A\265\245\250\354\271\272\245X\250\323\252\272\256\311\255\324\241A\246A\245h\255\327\245\277\247A\252\272\253Y\274\306\241A\244]\254O\244@\272\330\244\350\252k"), NULL);

  hseparator3 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator3);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator3", hseparator3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator3);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator3, TRUE, TRUE, 5);

  hbox6 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox6);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox6", hbox6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox6);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox6, TRUE, TRUE, 5);

  label11 = gtk_label_new (_("\302o\252i\276\271\251\372\262\323\263W\256\346\241G"));
  gtk_widget_ref (label11);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label11", label11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (hbox6), label11, FALSE, FALSE, 5);

  move_average = gtk_radio_button_new_with_label (_2_group, _("FIR\241G\262\276\260\312\245\255\247\241\302o\252i\276\271"));
  _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (move_average));
  gtk_widget_ref (move_average);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "move_average", move_average,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (move_average);
  gtk_box_pack_start (GTK_BOX (hbox6), move_average, FALSE, FALSE, 0);

  window = gtk_radio_button_new_with_label (_2_group, _("FIR\241G\265\370\265\241\302o\252i\276\271"));
  _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (window));
  gtk_widget_ref (window);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "window", window,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (window);
  gtk_box_pack_start (GTK_BOX (hbox6), window, FALSE, FALSE, 0);

  butterworth = gtk_radio_button_new_with_label (_2_group, _("IIR\241G\245\244\252o\255\310\261o\302o\252i\276\271"));
  _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (butterworth));
  gtk_widget_ref (butterworth);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "butterworth", butterworth,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (butterworth);
  gtk_box_pack_start (GTK_BOX (hbox6), butterworth, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, butterworth, _("\250\344\271\352\264N\254O\244\332\257S\250U\264\376\260\325\241I"), NULL);

  chebyshev = gtk_radio_button_new_with_label (_2_group, _("IIR\241G\253\264\244\361\263\267\244\322\302o\252i\276\271"));
  _2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (chebyshev));
  gtk_widget_ref (chebyshev);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "chebyshev", chebyshev,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (chebyshev);
  gtk_box_pack_start (GTK_BOX (hbox6), chebyshev, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chebyshev), TRUE);

  hbox8 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox8);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox8", hbox8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox8);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox8, TRUE, TRUE, 5);

  fs_label = gtk_label_new (_("\250\372\274\313\300W\262v"));
  gtk_widget_ref (fs_label);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "fs_label", fs_label,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (fs_label);
  gtk_box_pack_start (GTK_BOX (hbox8), fs_label, FALSE, FALSE, 10);

  fs = gtk_entry_new ();
  gtk_widget_ref (fs);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "fs", fs,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (fs);
  gtk_box_pack_start (GTK_BOX (hbox8), fs, TRUE, TRUE, 0);
  gtk_widget_set_usize (fs, 1, -2);
  gtk_tooltips_set_tip (tooltips, fs, _("\263\346\246\354\254\260\273\256\257\367"), NULL);
  gtk_entry_set_text (GTK_ENTRY (fs), _("20000"));

  pass_edge_label = gtk_label_new (_("\263q\261a\272I\244\356\300W\262v"));
  gtk_widget_ref (pass_edge_label);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_edge_label", pass_edge_label,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pass_edge_label);
  gtk_box_pack_start (GTK_BOX (hbox8), pass_edge_label, FALSE, FALSE, 10);

  pass_edge = gtk_entry_new ();
  gtk_widget_ref (pass_edge);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_edge", pass_edge,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pass_edge);
  gtk_box_pack_start (GTK_BOX (hbox8), pass_edge, TRUE, TRUE, 0);
  gtk_widget_set_usize (pass_edge, 1, -2);
  gtk_tooltips_set_tip (tooltips, pass_edge, _("\263\346\246\354\254\260\273\256\257\367"), NULL);
  gtk_entry_set_text (GTK_ENTRY (pass_edge), _("5000"));

  stop_edge_label = gtk_label_new (_("\244\356\261a\272I\244\356\300W\262v"));
  gtk_widget_ref (stop_edge_label);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_edge_label", stop_edge_label,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (stop_edge_label);
  gtk_box_pack_start (GTK_BOX (hbox8), stop_edge_label, FALSE, FALSE, 10);

  stop_edge = gtk_entry_new ();
  gtk_widget_ref (stop_edge);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_edge", stop_edge,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (stop_edge);
  gtk_box_pack_start (GTK_BOX (hbox8), stop_edge, TRUE, TRUE, 0);
  gtk_widget_set_usize (stop_edge, 1, -2);
  gtk_tooltips_set_tip (tooltips, stop_edge, _("\263\346\246\354\254\260\273\256\257\367"), NULL);
  gtk_entry_set_text (GTK_ENTRY (stop_edge), _("7500"));

  pass_ripple_label = gtk_label_new (_("\263q\261a\272\247\252i"));
  gtk_widget_ref (pass_ripple_label);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_ripple_label", pass_ripple_label,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pass_ripple_label);
  gtk_box_pack_start (GTK_BOX (hbox8), pass_ripple_label, FALSE, FALSE, 10);

  pass_ripple = gtk_entry_new ();
  gtk_widget_ref (pass_ripple);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "pass_ripple", pass_ripple,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pass_ripple);
  gtk_box_pack_start (GTK_BOX (hbox8), pass_ripple, TRUE, TRUE, 0);
  gtk_widget_set_usize (pass_ripple, 1, -2);
  gtk_tooltips_set_tip (tooltips, pass_ripple, _("\263\346\246\354\254\260\244\300\250\251\274W\257q"), NULL);
  gtk_entry_set_text (GTK_ENTRY (pass_ripple), _("1"));

  stop_ripple_label = gtk_label_new (_("\244\356\261a\272\247\252i"));
  gtk_widget_ref (stop_ripple_label);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_ripple_label", stop_ripple_label,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (stop_ripple_label);
  gtk_box_pack_start (GTK_BOX (hbox8), stop_ripple_label, FALSE, FALSE, 10);

  stop_ripple = gtk_entry_new ();
  gtk_widget_ref (stop_ripple);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "stop_ripple", stop_ripple,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (stop_ripple);
  gtk_box_pack_start (GTK_BOX (hbox8), stop_ripple, TRUE, TRUE, 10);
  gtk_widget_set_usize (stop_ripple, 1, -2);
  gtk_tooltips_set_tip (tooltips, stop_ripple, _("\263\346\246\354\254\260\244\300\250\251\274W\257q"), NULL);
  gtk_entry_set_text (GTK_ENTRY (stop_ripple), _("32"));

  hseparator2 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator2);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hseparator2", hseparator2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator2);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, TRUE, TRUE, 5);

  hbox10 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox10);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox10", hbox10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox10);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox10, TRUE, TRUE, 5);

  label12 = gtk_label_new (_("\260\262\263]\244\247\253Y\274\306\261a\244J\302\340\262\276\250\347\246\241\241G"));
  gtk_widget_ref (label12);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label12", label12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (hbox10), label12, FALSE, FALSE, 5);

  fir_input_coefficient = gtk_radio_button_new_with_label (_3_group, _("\246\263\255\255\257\337\275\304 FIR \302o\252i\276\271"));
  _3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (fir_input_coefficient));
  gtk_widget_ref (fir_input_coefficient);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "fir_input_coefficient", fir_input_coefficient,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (fir_input_coefficient);
  gtk_box_pack_start (GTK_BOX (hbox10), fir_input_coefficient, FALSE, FALSE, 10);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fir_input_coefficient), TRUE);

  iir_input_coefficient = gtk_radio_button_new_with_label (_3_group, _("\265L\255\255\257\337\275\304 IIR \302o\252i\276\271"));
  _3_group = gtk_radio_button_group (GTK_RADIO_BUTTON (iir_input_coefficient));
  gtk_widget_ref (iir_input_coefficient);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "iir_input_coefficient", iir_input_coefficient,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (iir_input_coefficient);
  gtk_box_pack_start (GTK_BOX (hbox10), iir_input_coefficient, FALSE, FALSE, 10);

  identify_stability = gtk_button_new_with_label (_("IIR \302o\252i\276\271\303\255\251w\253\327\305\262\251w(\245\274\247\271\246\250)"));
  gtk_widget_ref (identify_stability);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "identify_stability", identify_stability,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (identify_stability);
  gtk_box_pack_start (GTK_BOX (hbox10), identify_stability, FALSE, FALSE, 10);
  gtk_tooltips_set_tip (tooltips, identify_stability, _("\246]\254\260\247A\252\272\302\340\262\276\250\347\274\306\254O\260\262\263]\252\272\255\310\241A\251\322\245H\303\255\244\243\303\255\251w\247A\244]\244\243\275T\251w\241A\246\271\266s\245i\245H\247P\302_\244@\244U\241A\246]\254\260 FIR \244@\251w\254O\303\255\251w\252\272\241A\251\322\245H\244\243\245\316\264\372\244F\241C"), NULL);

  hbox14 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox14);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox14", hbox14,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox14);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox14, TRUE, TRUE, 5);

  label16 = gtk_label_new (_("\302\340\262\276\250\347\274\306\244\300\245\300 Y( n ) "));
  gtk_widget_ref (label16);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label16", label16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label16);
  gtk_box_pack_start (GTK_BOX (hbox14), label16, FALSE, FALSE, 10);

  a_value = gtk_entry_new ();
  gtk_widget_ref (a_value);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "a_value", a_value,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (a_value);
  gtk_box_pack_start (GTK_BOX (hbox14), a_value, TRUE, TRUE, 10);
  gtk_widget_set_usize (a_value, 1, -2);
  gtk_tooltips_set_tip (tooltips, a_value, _("\264N\254O\302\340\262\276\250\347\274\306\244\244\252\272\244\300\245\300\263\241\245\367\241A\267\355\265M\263o\245u\246\263 IIR \244~\267|\246\263\252\272"), NULL);
  gtk_entry_set_text (GTK_ENTRY (a_value), _("1 -0.7757"));

  label17 = gtk_label_new (_("\302\340\262\276\250\347\274\306\244\300\244l X( n )"));
  gtk_widget_ref (label17);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "label17", label17,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label17);
  gtk_box_pack_start (GTK_BOX (hbox14), label17, FALSE, FALSE, 10);

  b_value = gtk_entry_new ();
  gtk_widget_ref (b_value);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "b_value", b_value,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (b_value);
  gtk_box_pack_start (GTK_BOX (hbox14), b_value, TRUE, TRUE, 10);
  gtk_widget_set_usize (b_value, 1, -2);
  gtk_entry_set_text (GTK_ENTRY (b_value), _("4.7 2.2 3.6 2.2 4.7"));

  appbar1 = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
  gtk_widget_ref (appbar1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "appbar1", appbar1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (appbar1);
  gtk_box_pack_start (GTK_BOX (vbox1), appbar1, TRUE, TRUE, 0);

  hbox28 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox28);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "hbox28", hbox28,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox28);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox28, TRUE, TRUE, 0);

  statusbar1 = gtk_statusbar_new ();
  gtk_widget_ref (statusbar1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "statusbar1", statusbar1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (statusbar1);
  gtk_box_pack_start (GTK_BOX (hbox28), statusbar1, FALSE, FALSE, 0);
  gtk_widget_set_usize (statusbar1, 629, -2);

  progressbar1 = gtk_progress_bar_new ();
  gtk_widget_ref (progressbar1);
  gtk_object_set_data_full (GTK_OBJECT (rs232), "progressbar1", progressbar1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (progressbar1);
  gtk_box_pack_start (GTK_BOX (hbox28), progressbar1, FALSE, FALSE, 0);
  gtk_progress_set_show_text (GTK_PROGRESS (progressbar1), TRUE);
  gtk_progress_set_format_string (GTK_PROGRESS (progressbar1), _("%P %% \247\271\246\250"));

  gtk_signal_connect (GTK_OBJECT (rs232), "delete_event",
                      GTK_SIGNAL_FUNC (on_rs232_delete_event),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (rs232), "show",
                      GTK_SIGNAL_FUNC (on_rs232_show),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (exit), "clicked",
                      GTK_SIGNAL_FUNC (on_exit_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (swap), "clicked",
                      GTK_SIGNAL_FUNC (on_swap_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (clean_data_area), "clicked",
                      GTK_SIGNAL_FUNC (on_clean_data_area_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo_entry_baudrate), "changed",
                      GTK_SIGNAL_FUNC (on_combo_entry_baudrate_changed),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo_entry_port), "changed",
                      GTK_SIGNAL_FUNC (on_combo_entry_port_changed),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (save_as_numeral), "clicked",
                      GTK_SIGNAL_FUNC (on_save_as_numeral_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (spectrum), "clicked",
                      GTK_SIGNAL_FUNC (on_spectrum_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (inspect), "clicked",
                      GTK_SIGNAL_FUNC (on_inspect_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (print_spectrum), "toggled",
                      GTK_SIGNAL_FUNC (on_print_spectrum_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (save_as_eps), "clicked",
                      GTK_SIGNAL_FUNC (on_save_as_eps_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (specification_on), "clicked",
                      GTK_SIGNAL_FUNC (on_specification_on_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (coefficient_on), "clicked",
                      GTK_SIGNAL_FUNC (on_coefficient_on_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (move_average), "clicked",
                      GTK_SIGNAL_FUNC (on_move_average_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (window), "clicked",
                      GTK_SIGNAL_FUNC (on_window_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (butterworth), "clicked",
                      GTK_SIGNAL_FUNC (on_butterworth_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (chebyshev), "clicked",
                      GTK_SIGNAL_FUNC (on_chebyshev_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (fir_input_coefficient), "clicked",
                      GTK_SIGNAL_FUNC (on_fir_input_coefficient_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (iir_input_coefficient), "clicked",
                      GTK_SIGNAL_FUNC (on_iir_input_coefficient_clicked),
                      NULL);

  gtk_object_set_data (GTK_OBJECT (rs232), "tooltips", tooltips);

  gtk_window_add_accel_group (GTK_WINDOW (rs232), accel_group);

  return rs232;
}
static GtkWidget*
preview_collection (int font_size,
                    PangoFontDescription *base_desc)
{
    GtkWidget *box;
    GtkWidget *sw;
    GdkColor desktop_color;
    int i;
    GtkWidget *eventbox;

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

    box = gtk_vbox_new (FALSE, 0);
    gtk_box_set_spacing (GTK_BOX (box), 20);
    gtk_container_set_border_width (GTK_CONTAINER (box), 20);

    eventbox = gtk_event_box_new ();
    gtk_container_add (GTK_CONTAINER (eventbox), box);

    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), eventbox);

    desktop_color.red = 0x5144;
    desktop_color.green = 0x75D6;
    desktop_color.blue = 0xA699;

    gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &desktop_color);

    i = 0;
    while (i < META_FRAME_TYPE_LAST)
    {
        const char *title = NULL;
        GtkWidget *contents;
        GtkWidget *align;
        double xalign, yalign;
        GtkWidget *eventbox2;
        GtkWidget *preview;
        PangoFontDescription *font_desc;
        double scale;

        eventbox2 = gtk_event_box_new ();

        preview = meta_preview_new ();

        gtk_container_add (GTK_CONTAINER (eventbox2), preview);

        meta_preview_set_frame_type (META_PREVIEW (preview), i);
        meta_preview_set_frame_flags (META_PREVIEW (preview),
                                      get_window_flags (i));

        meta_preview_set_theme (META_PREVIEW (preview), global_theme);

        contents = get_window_contents (i, &title);

        meta_preview_set_title (META_PREVIEW (preview), title);

        gtk_container_add (GTK_CONTAINER (preview), contents);

        if (i == META_FRAME_TYPE_MENU)
        {
            xalign = 0.0;
            yalign = 0.0;
        }
        else
        {
            xalign = 0.5;
            yalign = 0.5;
        }

        align = gtk_alignment_new (0.0, 0.0, xalign, yalign);
        gtk_container_add (GTK_CONTAINER (align), eventbox2);

        gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0);

        switch (font_size)
        {
        case FONT_SIZE_SMALL:
            scale = PANGO_SCALE_XX_SMALL;
            break;
        case FONT_SIZE_LARGE:
            scale = PANGO_SCALE_XX_LARGE;
            break;
        default:
            scale = 1.0;
            break;
        }

        if (scale != 1.0)
        {
            font_desc = pango_font_description_new ();

            pango_font_description_set_size (font_desc,
                                             MAX (pango_font_description_get_size (base_desc) * scale, 1));

            gtk_widget_modify_font (preview, font_desc);

            pango_font_description_free (font_desc);
        }

        previews[font_size*META_FRAME_TYPE_LAST + i] = preview;

        ++i;
    }

    return sw;
}
Example #8
0
static void
gtk_combo_init (GtkCombo * combo)
{
  GtkWidget *arrow;
  GtkWidget *frame;
  GtkWidget *event_box;
  GdkCursor *cursor;

  combo->case_sensitive = 0;
  combo->value_in_list = 0;
  combo->ok_if_empty = 1;
  combo->use_arrows = 1;
  combo->use_arrows_always = 0;
  combo->entry = gtk_entry_new ();
  combo->button = gtk_button_new ();
  combo->current_button = 0;
  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
  gtk_widget_show (arrow);
  gtk_container_add (GTK_CONTAINER (combo->button), arrow);
  gtk_box_pack_start (GTK_BOX (combo), combo->entry, TRUE, TRUE, 0);
  gtk_box_pack_end (GTK_BOX (combo), combo->button, FALSE, FALSE, 0);
  GTK_WIDGET_UNSET_FLAGS (combo->button, GTK_CAN_FOCUS);
  gtk_widget_show (combo->entry);
  gtk_widget_show (combo->button);
  combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
			      (GtkSignalFunc) gtk_combo_update_list, combo);
  gtk_signal_connect (GTK_OBJECT (combo->entry), "key_press_event",
		      (GtkSignalFunc) gtk_combo_entry_key_press, combo);
  gtk_signal_connect_after (GTK_OBJECT (combo->entry), "focus_out_event",
			    (GtkSignalFunc) gtk_combo_entry_focus_out, combo);
  combo->activate_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "activate",
		      (GtkSignalFunc) gtk_combo_activate, combo);
  gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_press_event",
			    (GtkSignalFunc) gtk_combo_popup_button_press, combo);
  /*gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_release_event",
    (GtkSignalFunc) gtk_combo_button_release, combo);*/
  gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event",
		      (GtkSignalFunc) gtk_combo_popup_button_leave, combo);
  /*gtk_signal_connect(GTK_OBJECT(combo->button), "clicked",
     (GtkSignalFunc)prelight_bug, combo); */

  combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_widget_ref (combo->popwin);
  gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0);
  
  gtk_widget_set_events (combo->popwin, GDK_KEY_PRESS_MASK);

  event_box = gtk_event_box_new ();
  gtk_container_add (GTK_CONTAINER (combo->popwin), event_box);
  gtk_widget_show (event_box);

  gtk_widget_realize (event_box);
  cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
  gdk_window_set_cursor (event_box->window, cursor);
  gdk_cursor_destroy (cursor);

  frame = gtk_frame_new (NULL);
  gtk_container_add (GTK_CONTAINER (event_box), frame);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  gtk_widget_show (frame);

  combo->popup = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup),
				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->hscrollbar, GTK_CAN_FOCUS);
  GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar, GTK_CAN_FOCUS);
  gtk_container_add (GTK_CONTAINER (frame), combo->popup);
  gtk_widget_show (combo->popup);

  combo->list = gtk_list_new ();
  /* We'll use enter notify events to figure out when to transfer
   * the grab to the list
   */
  gtk_widget_set_events (combo->list, GDK_ENTER_NOTIFY_MASK);

  gtk_list_set_selection_mode(GTK_LIST(combo->list), GTK_SELECTION_BROWSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (combo->popup), combo->list);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (combo->list),
				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (combo->popup)));
  gtk_container_set_focus_hadjustment (GTK_CONTAINER (combo->list),
				       gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (combo->popup)));
  gtk_widget_show (combo->list);

  combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed",
			     (GtkSignalFunc) gtk_combo_update_entry, combo);
  gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event",
		      (GtkSignalFunc) gtk_combo_list_key_press, combo);
  gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
		      GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);

  gtk_signal_connect_after (GTK_OBJECT (combo->list), "button_release_event",
			    GTK_SIGNAL_FUNC (gtk_combo_button_release), combo);
  /* We connect here on the button, because we'll have a grab on it
   * when the event occurs. But we are actually interested in enters
   * for the combo->list.
   */
  gtk_signal_connect (GTK_OBJECT (combo->button), "enter_notify_event",
		      GTK_SIGNAL_FUNC (gtk_combo_list_enter), combo);
}
Example #9
0
static void
wikipad_statusbar_init (WikipadStatusbar *statusbar)
{
  GtkWidget    *ebox, *box, *separator, *label;
  GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
  GList *frame;

  /* init statusbar */
#if ! GTK_CHECK_VERSION(3, 0, 0)
  gtk_statusbar_set_has_resize_grip (bar, TRUE);
#endif

  /* create a new horizontal box */
  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
  gtk_widget_show (box);

  /* reorder the gtk statusbar */
  frame = gtk_container_get_children (GTK_CONTAINER (bar));
  gtk_frame_set_shadow_type (GTK_FRAME (frame->data), GTK_SHADOW_NONE);
  label = gtk_bin_get_child (GTK_BIN (frame->data));
  g_object_ref (label);
  gtk_container_remove (GTK_CONTAINER (frame->data), label);
  gtk_container_add (GTK_CONTAINER (frame->data), box);
  gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
  g_object_unref (label);
  g_list_free (frame);

  /* separator */
  separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
  gtk_widget_show (separator);

  /* language/filetype event box */
  ebox = gtk_event_box_new ();
  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
  gtk_widget_set_tooltip_text (ebox, _("Choose a filetype"));
  g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK (wikipad_statusbar_filetype_clicked), statusbar);
  gtk_widget_show (ebox);

  /* language/filetype */
  statusbar->language = gtk_label_new (_("Filetype: None"));
  gtk_container_add (GTK_CONTAINER (ebox), statusbar->language);
  gtk_widget_show (statusbar->language);

  /* separator */
  separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
  gtk_widget_show (separator);

  /* line and column numbers */
  statusbar->position = gtk_label_new (NULL);
  gtk_box_pack_start (GTK_BOX (box), statusbar->position, FALSE, TRUE, 0);
  gtk_widget_show (statusbar->position);

  /* separator */
  separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
  gtk_widget_show (separator);

  /* overwrite event box */
  ebox = gtk_event_box_new ();
  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
  gtk_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
  g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK (wikipad_statusbar_overwrite_clicked), statusbar);
  gtk_widget_show (ebox);

  /* overwrite label */
  statusbar->overwrite = gtk_label_new (_("OVR"));
  gtk_container_add (GTK_CONTAINER (ebox), statusbar->overwrite);
  gtk_widget_show (statusbar->overwrite);
}
/* Create new notification */
GtkWindow *
create_notification(UrlClickedCb url_clicked)
{
	GtkWidget *win;
	GtkWidget *drawbox;
	GtkWidget *main_vbox;
	GtkWidget *vbox;
	GtkWidget *alignment;
    GtkWidget *padding;
	AtkObject *atkobj;
	WindowData *windata;
	GdkColormap *colormap;
	GdkScreen *screen;

	windata = g_new0(WindowData, 1);
	windata->urgency = URGENCY_NORMAL;
	windata->url_clicked = url_clicked;

	win = gtk_window_new(GTK_WINDOW_POPUP);
	windata->win = win;

	windata->rtl = gtk_widget_get_default_direction();
	windata->enable_transparency = FALSE;
	screen = gtk_window_get_screen(GTK_WINDOW(win));
	colormap = gdk_screen_get_rgba_colormap(screen);

	if (colormap != NULL)
	{
		gtk_widget_set_colormap(win, colormap);
		if (gdk_screen_is_composited(screen))
			windata->enable_transparency = TRUE;
	}

	gtk_window_set_title(GTK_WINDOW(win), "Notification");
	gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
	gtk_widget_realize(win);

	g_object_set_data_full(G_OBJECT(win), "windata", windata,
						   (GDestroyNotify)destroy_windata);
	atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT);

	g_signal_connect(G_OBJECT(win), "configure_event",
					 G_CALLBACK(configure_event_cb), windata);

	/*
	 * For some reason, there are occasionally graphics glitches when
	 * repainting the window. Despite filling the window with a background
	 * color, parts of the other windows on the screen or the shadows around
	 * notifications will appear on the notification. Somehow, adding this
	 * eventbox makes that problem just go away. Whatever works for now.
	 */
	drawbox = gtk_event_box_new();
	gtk_widget_show(drawbox);
	gtk_container_add(GTK_CONTAINER(win), drawbox);

	main_vbox = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(main_vbox);
	gtk_container_add(GTK_CONTAINER(drawbox), main_vbox);

	g_signal_connect(G_OBJECT(main_vbox), "expose_event",
					 G_CALLBACK(paint_window), windata);

    padding = gtk_alignment_new(0, 0, 0, 0);
	gtk_widget_show(padding);
	gtk_box_pack_start(GTK_BOX(main_vbox), padding, FALSE, FALSE, 0);
  g_object_set(G_OBJECT(padding), "top-padding", 8, "right-padding", 8, NULL);

	windata->main_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(windata->main_hbox);
	gtk_container_add(GTK_CONTAINER(padding), windata->main_hbox);
	gtk_container_set_border_width(GTK_CONTAINER(windata->main_hbox), 13);
   
    /* The icon goes at the left */ 
	windata->iconbox = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(windata->iconbox);
	gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox,
					   FALSE, FALSE, 0);
    
	windata->icon = gtk_image_new();
	gtk_box_pack_start(GTK_BOX(windata->iconbox), windata->icon,
					   FALSE, FALSE, 0);

    /* The title and the text at the right */
    padding = gtk_alignment_new(0, 0.5, 0, 0);
	gtk_widget_show(padding);
	gtk_box_pack_start(GTK_BOX(windata->main_hbox), padding, TRUE, TRUE, 0);
  g_object_set(G_OBJECT(padding), "left-padding", 8, NULL);

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(vbox);
	gtk_container_add(GTK_CONTAINER(padding), vbox);

	windata->summary_label = gtk_label_new(NULL);
	gtk_widget_show(windata->summary_label);
	gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, FALSE, FALSE, 0);
	gtk_misc_set_alignment(GTK_MISC(windata->summary_label), 0, 0);
	gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE);

	atkobj = gtk_widget_get_accessible(windata->summary_label);
	atk_object_set_description(atkobj, "Notification summary text.");

	windata->body_label = gtk_label_new(NULL);
	gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, FALSE, FALSE, 0);
	gtk_misc_set_alignment(GTK_MISC(windata->body_label), 0, 0);
	gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE);
	g_signal_connect(G_OBJECT(windata->body_label), "activate-link",
                         G_CALLBACK(activate_link), windata);

	atkobj = gtk_widget_get_accessible(windata->body_label);
	atk_object_set_description(atkobj, "Notification body text.");

    /* Disabled for now */
	alignment = gtk_alignment_new(1, 0.5, 0, 0);
	gtk_widget_show(alignment);
    gtk_widget_hide(alignment);
	gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, TRUE, 0);

	windata->actions_box = gtk_hbox_new(FALSE, 6);
	gtk_container_add(GTK_CONTAINER(alignment), windata->actions_box);

	return GTK_WINDOW(win);
}
Example #11
0
void gaym_gtkconv_update_thumbnail(GaimConversation * conv, struct fetch_thumbnail_data
                                   *thumbnail_data)
{
    GaimGtkConversation *gtkconv;

    char filename[256];
    FILE *file;
    GError *err = NULL;

    size_t len;

    GdkPixbuf *buf;
    GdkPixbuf *scale;
    GdkPixmap *pm;
    GdkBitmap *bm;
    int scale_width, scale_height;


    GaimAccount *account;
    GaimPluginProtocolInfo *prpl_info = NULL;
    g_return_if_fail(conv != NULL);
    g_return_if_fail(GAIM_IS_GTK_CONVERSATION(conv));
    g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_CHAT);

    gtkconv = GAIM_GTK_CONVERSATION(conv);

    GaymChatIcon *icon_data = g_hash_table_lookup(icons, conv);

    if (!thumbnail_data)
        return;
    if (!icon_data->show_icon)
        return;

    const char *data = thumbnail_data->pic_data;
    len = thumbnail_data->pic_data_len;

    account = gaim_conversation_get_account(conv);
    if (account && account->gc)
        prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);


    if (icon_data->anim != NULL)
        g_object_unref(G_OBJECT(icon_data->anim));

    icon_data->anim = NULL;

    if (icon_data->icon_timer != 0)
        g_source_remove(icon_data->icon_timer);

    icon_data->icon_timer = 0;

    if (icon_data->iter != NULL)
        g_object_unref(G_OBJECT(icon_data->iter));

    icon_data->iter = NULL;

    if (!gaim_prefs_get_bool
        ("/gaim/gtk/conversations/im/show_buddy_icons"))
        return;

    if (gaim_conversation_get_gc(conv) == NULL)
        return;


    /* this is such an evil hack, i don't know why i'm even considering
       it. we'll do it differently when gdk-pixbuf-loader isn't leaky
       anymore. */
    /* gdk-pixbuf-loader was leaky? is it still? */

    g_snprintf(filename, sizeof(filename),
               "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d",
               g_get_tmp_dir(), thumbnail_data->who, getpid());

    if (!(file = g_fopen(filename, "wb")))
        return;

    fwrite(data, 1, len, file);
    fclose(file);
    icon_data->anim = gdk_pixbuf_animation_new_from_file(filename, &err);

    /* make sure we remove the file as soon as possible */
    g_unlink(filename);

    if (err) {
        gaim_debug(GAIM_DEBUG_ERROR, "gtkconv",
                   "Buddy icon error: %s\n", err->message);
        g_error_free(err);
    }



    if (!icon_data->anim)
        return;

    if (gdk_pixbuf_animation_is_static_image(icon_data->anim)) {
        icon_data->iter = NULL;
        buf = gdk_pixbuf_animation_get_static_image(icon_data->anim);
    } else {
        icon_data->iter = gdk_pixbuf_animation_get_iter(icon_data->anim, NULL); /* LEAK 
                                                                                 */
        buf = gdk_pixbuf_animation_iter_get_pixbuf(icon_data->iter);
    }

    get_icon_scale_size(icon_data->anim,
                        prpl_info ? &prpl_info->icon_spec : NULL,
                        &scale_width, &scale_height);
    scale =
        gdk_pixbuf_scale_simple(buf,
                                MAX(gdk_pixbuf_get_width(buf) *
                                    scale_width /
                                    gdk_pixbuf_animation_get_width
                                    (icon_data->anim), 1),
                                MAX(gdk_pixbuf_get_height(buf) *
                                    scale_height /
                                    gdk_pixbuf_animation_get_height
                                    (icon_data->anim), 1),
                                GDK_INTERP_NEAREST);

    gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
    g_object_unref(G_OBJECT(scale));


    icon_data->event = gtk_event_box_new();
    gtk_container_add(GTK_CONTAINER(icon_data->frame), icon_data->event);
    gtk_widget_set_size_request(GTK_WIDGET(icon_data->frame), scale_width,
                                scale_height);

    // g_signal_connect(G_OBJECT(icon_data->event), "button-press-event",
    // G_CALLBACK(icon_menu), conv);
    gtk_widget_show(icon_data->event);
    icon_data->icon = gtk_image_new_from_pixmap(pm, bm);
    gtk_container_add(GTK_CONTAINER(icon_data->event), icon_data->icon);
    gtk_widget_show(icon_data->icon);

    g_object_unref(G_OBJECT(pm));

    if (bm)
        g_object_unref(G_OBJECT(bm));


}
Example #12
0
File: testexpand.c Project: BYC/gtk
static void
create_box_window (void)
{
  GtkWidget *window;
  GtkWidget *box1, *box2, *box3;
  GtkWidget *toggle;
  GtkWidget *alignment;
  GtkWidget *colorbox;
  GdkRGBA red, blue;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Boxes");

  box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  box3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

  gtk_box_pack_start (GTK_BOX (box1),
                      gtk_label_new ("VBox 1 Top"),
                      FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (box1),
                      box2,
                      FALSE, TRUE, 0);
  gtk_box_pack_end (GTK_BOX (box1),
                    gtk_label_new ("VBox 1 Bottom"),
                    FALSE, FALSE, 0);

  gtk_box_pack_start (GTK_BOX (box2),
                      gtk_label_new ("HBox 2 Left"),
                      FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (box2),
                      box3,
                      FALSE, TRUE, 0);
  gtk_box_pack_end (GTK_BOX (box2),
                    gtk_label_new ("HBox 2 Right"),
                    FALSE, FALSE, 0);

  gtk_box_pack_start (GTK_BOX (box3),
                      gtk_label_new ("VBox 3 Top"),
                      FALSE, FALSE, 0);
  gtk_box_pack_end (GTK_BOX (box3),
                    gtk_label_new ("VBox 3 Bottom"),
                    FALSE, FALSE, 0);

  gdk_rgba_parse (&red, "red");
  gdk_rgba_parse (&blue, "blue");

  colorbox = gtk_event_box_new ();
  gtk_widget_override_background_color (colorbox, 0, &red);

  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
  gtk_container_add (GTK_CONTAINER (colorbox), alignment);

  toggle = gtk_toggle_button_new_with_label ("H Expand");
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_hexpand), NULL);
  gtk_container_add (GTK_CONTAINER (alignment), toggle);

  gtk_box_pack_start (GTK_BOX (box3),
                      colorbox,
                      FALSE, TRUE, 0);

  colorbox = gtk_event_box_new ();
  gtk_widget_override_background_color (colorbox, 0, &blue);

  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
  gtk_container_add (GTK_CONTAINER (colorbox), alignment);

  toggle = gtk_toggle_button_new_with_label ("V Expand");
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_vexpand), NULL);
  gtk_container_add (GTK_CONTAINER (alignment), toggle);
  gtk_box_pack_start (GTK_BOX (box3),
                      colorbox,
                      FALSE, TRUE, 0);

  gtk_container_add (GTK_CONTAINER (window), box1);
  gtk_widget_show_all (window);
}
Example #13
0
File: testexpand.c Project: BYC/gtk
static void
create_table_window (void)
{
  GtkWidget *window;
  GtkWidget *table;
  GtkWidget *toggle;
  GtkWidget *alignment;
  GtkWidget *colorbox;
  GdkRGBA red, blue;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Table");

  table = gtk_table_new (4, 3, FALSE);

  gtk_table_attach (GTK_TABLE (table),
                    gtk_label_new ("Top"),
                    1, 2, 0, 1,
                    GTK_FILL, GTK_FILL, 0, 0);
  gtk_table_attach (GTK_TABLE (table),
                    gtk_label_new ("Bottom"),
                    1, 2, 3, 4,
                    GTK_FILL, GTK_FILL, 0, 0);
  gtk_table_attach (GTK_TABLE (table),
                    gtk_label_new ("Left"),
                    0, 1, 1, 3,
                    GTK_FILL, GTK_FILL, 0, 0);
  gtk_table_attach (GTK_TABLE (table),
                    gtk_label_new ("Right"),
                    2, 3, 1, 3,
                    GTK_FILL, GTK_FILL, 0, 0);

  gdk_rgba_parse (&red, "red");
  gdk_rgba_parse (&blue, "blue");

  colorbox = gtk_event_box_new ();
  gtk_widget_override_background_color (colorbox, GTK_STATE_NORMAL, &red);

  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
  gtk_container_add (GTK_CONTAINER (colorbox), alignment);

  toggle = gtk_toggle_button_new_with_label ("H Expand");
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_hexpand), NULL);
  gtk_container_add (GTK_CONTAINER (alignment), toggle);

  gtk_table_attach (GTK_TABLE (table),
                    colorbox,
                    1, 2, 1, 2,
                    GTK_FILL, GTK_FILL, 0, 0);

  colorbox = gtk_event_box_new ();
  gtk_widget_override_background_color (colorbox, 0, &blue);

  alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
  gtk_container_add (GTK_CONTAINER (colorbox), alignment);

  toggle = gtk_toggle_button_new_with_label ("V Expand");
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_vexpand), NULL);
  gtk_container_add (GTK_CONTAINER (alignment), toggle);

  gtk_table_attach (GTK_TABLE (table),
                    colorbox,
                    1, 2, 2, 3,
                    GTK_FILL, GTK_FILL, 0, 0);

  gtk_container_add (GTK_CONTAINER (window), table);
  gtk_widget_show_all (window);
}
Example #14
0
void bestelakoak()
{
	GtkWidget *frame;
	GtkWidget *alignment;
	GtkWidget *fixed;
	GtkWidget *cmdGehi;
	GtkWidget *cmdKendu;
	GtkWidget *cmdAdos;
	GtkWidget *cmdUtzi;
	GtkWidget *cmdKen;
	GtkWidget *labela;
	GtkWidget *cmdGehitu;
	GtkWidget *taula;
	GtkWidget *eventbox;
	GtkWidget *cmdZenbakiak3;
	GtkWidget *cmdZenbakiak2;
	GtkWidget *cmdZenbakiak4;
	GtkWidget *cmdZenbakiak5;
	GtkWidget *cmdZenbakiak6;
	GtkWidget *cmdZenbakiak9;
	GtkWidget *cmdZenbakiak8;
	GtkWidget *cmdZenbakiak7;
	GtkWidget *cmdZenbakiak0;
	GtkWidget *cmdZenbakiak10;
	GtkWidget *cmdZenbakiak11;
	GtkWidget *cmdZenbakiak1;
	GtkTreeModel *model;
	GtkCellRenderer *renderer;
	
	/* Lehioa sortu eta konfiguratu */
	frmBestelakoak = gtk_window_new (GTK_WINDOW_POPUP);
	gtk_window_set_position (GTK_WINDOW (frmBestelakoak), GTK_WIN_POS_CENTER_ALWAYS);
	gtk_window_set_modal (GTK_WINDOW (frmBestelakoak), TRUE);
	gtk_window_set_decorated (GTK_WINDOW (frmBestelakoak), FALSE);
	//gtk_window_set_type_hint (GTK_WINDOW (frmBestelakoak), GDK_WINDOW_TYPE_HINT_DIALOG);
	//gtk_window_set_transient_for(GTK_WINDOW(frmBestelakoak), GTK_WINDOW(frmKontua));
	
	/* Lehioaren egitura sortu eta kokatu */
	frame = gtk_frame_new ("");
	gtk_container_add (GTK_CONTAINER (frmBestelakoak), frame);
	gdk_color_parse("#e3e0e0", &kolorea);
	gtk_widget_modify_bg(frame, GTK_STATE_NORMAL, &kolorea);
	
	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
	gtk_container_add (GTK_CONTAINER (frame), alignment);
	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
	
	fixed = gtk_fixed_new ();
	gtk_container_add (GTK_CONTAINER (alignment), fixed);

	labela = gtk_label_new ("<span size='large'><b> Sartu zerrendan bestelako gastuak </b></span>");
	gtk_fixed_put (GTK_FIXED (fixed), labela, 0, 0);
	gtk_widget_set_size_request (labela, 312, 32);
	gtk_label_set_use_markup (GTK_LABEL (labela), TRUE);

	/* Kalkulagailua sortu eta kokatu */
	frame = gtk_frame_new (NULL);
	gtk_fixed_put (GTK_FIXED (fixed), frame, 0, 32);
	gdk_color_parse("#858484", &kolorea);
	gtk_widget_modify_bg(frame, GTK_STATE_NORMAL, &kolorea);
	gtk_widget_set_size_request (frame, 250, 300);
	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

	alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
	gtk_container_add(GTK_CONTAINER(frame), alignment);
	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
	
	taula = gtk_table_new (10, 3, TRUE);
	gtk_container_add (GTK_CONTAINER (alignment), taula);
	gtk_table_set_row_spacings (GTK_TABLE (taula), 4);
	gtk_table_set_col_spacings (GTK_TABLE (taula), 4);
	
	txtZenbakiak = gtk_entry_new ();
	gtk_table_attach (GTK_TABLE (taula), txtZenbakiak, 0, 3, 0, 2,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_FILL), 0, 0);
	gtk_entry_set_invisible_char (GTK_ENTRY (txtZenbakiak), 9679);
	gtk_entry_set_text(GTK_ENTRY(txtZenbakiak), "0");
	
	cmdZenbakiak3 = gtk_button_new_with_label("3");
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak3, 2, 3, 6, 8,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak3), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak2 = gtk_button_new_with_label("2");
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak2, 1, 2, 6, 8,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak2), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak4 = gtk_button_new_with_label("4");
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak4, 0, 1, 4, 6,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak4), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak5 = gtk_button_new_with_label("5");
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak5, 1, 2, 4, 6,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak5), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak6 = gtk_button_new_with_label("6");
	gtk_widget_show (cmdZenbakiak6);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak6, 2, 3, 4, 6,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak6), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak9 = gtk_button_new_with_label("9");
	gtk_widget_show (cmdZenbakiak9);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak9, 2, 3, 2, 4,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak9), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak8 = gtk_button_new_with_label("8");
	gtk_widget_show (cmdZenbakiak8);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak8, 1, 2, 2, 4,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak8), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak7 = gtk_button_new_with_label("7");
	gtk_widget_show (cmdZenbakiak7);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak7, 0, 1, 2, 4,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak7), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak0 = gtk_button_new_with_label("0");
	gtk_widget_show (cmdZenbakiak0);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak0, 0, 1, 8, 10,
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak0), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak10 = gtk_button_new_with_label(",");
	gtk_widget_show (cmdZenbakiak10);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak10, 1, 2, 8, 10,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak10), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak11 = gtk_button_new_with_label("C");
	gtk_widget_show (cmdZenbakiak11);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak11, 2, 3, 8, 10,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak11), "clicked",
				G_CALLBACK(btmZenbakia), NULL);
	
	cmdZenbakiak1 = gtk_button_new_with_label("1");
	gtk_widget_show (cmdZenbakiak1);
	gtk_table_attach (GTK_TABLE (taula), cmdZenbakiak1, 0, 1, 6, 8,
			(GtkAttachOptions) (GTK_FILL),
			(GtkAttachOptions) (GTK_FILL), 0, 0);
	g_signal_connect(G_OBJECT(cmdZenbakiak1), "clicked",
				G_CALLBACK(btmZenbakia), NULL);

	labela = gtk_label_new("<span size='x-large'>>></span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdGehitu = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdGehitu), labela);
	gtk_fixed_put (GTK_FIXED (fixed), cmdGehitu, 256, 136);
	gtk_widget_set_size_request (cmdGehitu, 96, 64);
	g_signal_connect(G_OBJECT(cmdGehitu), "clicked",
			G_CALLBACK(btmGehitu), NULL);
	
	labela = gtk_label_new("<span size='x-large'> Kendu </span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdKendu = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdKendu), labela);
	gtk_fixed_put (GTK_FIXED (fixed), cmdKendu, 256, 216);
	gtk_widget_set_size_request (cmdKendu, 96, 64);
	g_signal_connect(G_OBJECT(cmdKendu), "clicked",
			G_CALLBACK(btmKendu), NULL);

	model = GTK_TREE_MODEL (gtk_tree_store_new(1, G_TYPE_STRING));
	lista = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (lista),
					-1, "Sartutakoak", renderer,
					"text", 0,
					NULL);
	gtk_fixed_put (GTK_FIXED (fixed), lista, 368, 0);
	gtk_widget_set_size_request (lista, 208, 560);

	labela = gtk_label_new ("<span size='large'><b> Zenbat zarete ordaintzeko? </b></span>");
	gtk_fixed_put (GTK_FIXED (fixed), labela, 16, 344);
	gtk_widget_set_size_request (labela, 296, 32);
	gtk_label_set_use_markup (GTK_LABEL (labela), TRUE);

	labela = gtk_label_new("<span size='x-large'>+</span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdGehi = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdGehi), labela);
	gtk_fixed_put (GTK_FIXED (fixed), cmdGehi, 112, 384);
	gtk_widget_set_size_request (cmdGehi, 64, 48);
	g_signal_connect(G_OBJECT(cmdGehi), "clicked",
			G_CALLBACK(btmGehi), NULL);
	gdk_color_parse("#bff9ed", &kolorea);
	gtk_widget_modify_bg(cmdGehi, GTK_STATE_NORMAL, &kolorea);
	gtk_widget_modify_bg(cmdGehi, GTK_STATE_PRELIGHT, &kolorea);
	
	labela = gtk_label_new("<span size='x-large'>-</span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdKen = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdKen), labela);
	gtk_fixed_put (GTK_FIXED (fixed), cmdKen, 176, 384);
	gtk_widget_set_size_request (cmdKen, 64, 48);
	g_signal_connect(G_OBJECT(cmdKen), "clicked",
			G_CALLBACK(btmKen), NULL);
	gdk_color_parse("#fdb5d5", &kolorea);
	gtk_widget_modify_bg(cmdKen, GTK_STATE_NORMAL, &kolorea);
	gtk_widget_modify_bg(cmdKen, GTK_STATE_PRELIGHT, &kolorea);
	
	lblZenbat = gtk_label_new ("<span size='xx-large'><b>1</b></span>");
	gtk_widget_set_size_request (lblZenbat, 96, 48);
	gtk_label_set_use_markup (GTK_LABEL (lblZenbat), TRUE);
	eventbox = gtk_event_box_new();
	gtk_widget_set_size_request (eventbox, 96, 48);
	gtk_container_add(GTK_CONTAINER(eventbox), lblZenbat);
	gdk_color_parse("black", &kolorea);
	gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &kolorea);
	gdk_color_parse("yellow", &kolorea);
	gtk_widget_modify_fg(lblZenbat, GTK_STATE_NORMAL, &kolorea);
	gtk_fixed_put (GTK_FIXED (fixed), eventbox, 16, 384);

	labela = gtk_label_new("<span size='x-large'>Ados</span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdAdos = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdAdos), labela);
	gtk_widget_show (cmdAdos);
	gtk_fixed_put (GTK_FIXED (fixed), cmdAdos, 24, 480);
	gtk_widget_set_size_request (cmdAdos, 136, 48);
	g_signal_connect(G_OBJECT(cmdAdos), "clicked",
			G_CALLBACK(btmAdos), NULL);
	
	labela = gtk_label_new("<span size='x-large'>Utzi</span>");
	gtk_label_set_use_markup(GTK_LABEL(labela), TRUE);
	cmdUtzi = gtk_button_new();
	gtk_container_add(GTK_CONTAINER(cmdUtzi), labela);
	gtk_widget_show (cmdUtzi);
	gtk_fixed_put (GTK_FIXED (fixed), cmdUtzi, 192, 480);
	gtk_widget_set_size_request (cmdUtzi, 136, 48);
	g_signal_connect(G_OBJECT(cmdUtzi), "clicked",
			G_CALLBACK(btmUtzi), NULL);

	/* Dena bistaratu eta martxan jarri */
	form_load();
	gtk_widget_show_all(frmBestelakoak);
	gtk_main();
}
Example #15
0
static void serverstats_init(void)
{
	/** Get an allready exposed widgets to grab theme colors from. */
	GtkWidget *colw = (GtkWidget *) playlist3_get_category_tree_view();
	GtkWidget *label = NULL;
	GtkWidget *table = NULL;
	GtkWidget *hbox = NULL;
	GtkWidget *event = NULL;
	GtkWidget *serverstats_vbox = gtk_vbox_new(FALSE, 0);
	GtkWidget *serverstats_event;
	gchar *markup = NULL;
	int i = 0;

	serverstats_sw = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(serverstats_sw), GTK_SHADOW_IN);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(serverstats_sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

	serverstats_event = gtk_event_box_new();
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(serverstats_event), TRUE);
	gtk_container_add(GTK_CONTAINER(serverstats_event), serverstats_vbox);

	/* wrap in event box to set bg color */
	event = gtk_event_box_new();
	gtk_widget_set_app_paintable(event, TRUE);
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), TRUE);
	gtk_widget_set_state(GTK_WIDGET(event), GTK_STATE_SELECTED);
	g_signal_connect(G_OBJECT(event), "expose-event", G_CALLBACK(misc_header_expose_event), NULL);

	gtk_widget_modify_bg(serverstats_event, GTK_STATE_NORMAL, &(colw->style->base[GTK_STATE_NORMAL]));
	g_signal_connect(G_OBJECT(serverstats_vbox), "style-set", G_CALLBACK(serverstats_header_style_changed),
					 serverstats_event);

	/* set label and padding */
	hbox = gtk_hbox_new(FALSE, 6);
	label = gtk_image_new_from_icon_name("mpd", GTK_ICON_SIZE_DND);
	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
	label = gtk_label_new("");
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	markup = g_markup_printf_escaped("<span size='xx-large' weight='bold'>%s</span>", _("Server Information"));
	gtk_label_set_markup(GTK_LABEL(label), markup);
	g_free(markup);
	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(event), hbox);

	gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
	gtk_box_pack_start(GTK_BOX(serverstats_vbox), event, FALSE, TRUE, 0);
	gtk_widget_show_all(event);

	label = gtk_hseparator_new();
	gtk_box_pack_start(GTK_BOX(serverstats_vbox), label, FALSE, TRUE, 0);
	gtk_widget_show(label);
	/**
     * Data list 
     */
	table = gtk_table_new(SERVERSTATS_NUM_FIELDS + 2, 2, FALSE);
	gtk_table_set_col_spacings(GTK_TABLE(table), 6);
	gtk_table_set_row_spacings(GTK_TABLE(table), 6);
	gtk_container_set_border_width(GTK_CONTAINER(table), 12);

	/** Database */
	label = gtk_label_new("");
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
	markup = g_markup_printf_escaped("<span size='x-large' weight='bold'>%s</span>", _("Server"));
	gtk_label_set_markup(GTK_LABEL(label), markup);
	g_free(markup);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);

	i = 1;
	/** Mpd version */
	serverstats_add_entry(table, i++, _("Version"), SERVERSTATS_MPD_VERSION);

	serverstats_add_entry(table, i++, _("Uptime"), SERVERSTATS_MPD_UPTIME);
	serverstats_add_entry(table, i++, _("Time Playing"), SERVERSTATS_MPD_PLAYTIME);

	/** Database */
	label = gtk_label_new("");
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	markup = g_markup_printf_escaped("<span size='x-large' weight='bold'>%s</span>", _("Database"));
	gtk_label_set_markup(GTK_LABEL(label), markup);
	g_free(markup);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, i, i + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
	i++;

	/** Mpd Playtime */
	serverstats_add_entry(table, i++, _("Total Playtime"), SERVERSTATS_MPD_DB_PLAYTIME);
	/** Mpd Artists*/
	serverstats_add_entry(table, i++, _("Number of artists"), SERVERSTATS_MPD_DB_ARTISTS);
	/** Mpd Albums */
	serverstats_add_entry(table, i++, _("Number of albums"), SERVERSTATS_MPD_DB_ALBUMS);
	/** Mpd Songs */
	serverstats_add_entry(table, i++, _("Number of songs"), SERVERSTATS_MPD_DB_SONGS);
	/** Mpd Songs */
	serverstats_add_entry(table, i++, _("URL Handlers"), SERVERSTATS_MPD_URLHANDLERS);
	/** Mpd Songs */
	serverstats_add_entry(table, i++, _("Tag Types"), SERVERSTATS_MPD_TAG_TYPES);
	/** Stats */
	label = gtk_label_new("");
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	markup = g_markup_printf_escaped("<span size='x-large' weight='bold'>%s</span>", _("Tag statistics"));
	gtk_label_set_markup(GTK_LABEL(label), markup);
	g_free(markup);
	gtk_table_attach(GTK_TABLE(table), label, 0, 2, i, i + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
	i++;
	gtk_widget_show_all(table);

	/**
     * Stats treeview
     */
	{
		GtkWidget *combo = NULL;
		GtkWidget *sw = NULL, *cancel;
		GtkListStore *store;
		GtkCellRenderer *renderer;
		GtkWidget *pb = gtk_progress_bar_new();
		combo = gtk_combo_box_new_text();
		for (i = 0; i < MPD_TAG_NUM_OF_ITEM_TYPES - 1; i++)
		{
			if (mpd_server_tag_supported(connection, i))
			{
				gtk_combo_box_append_text(GTK_COMBO_BOX(combo), mpdTagItemKeys[i]);
			}
		}

		gtk_table_attach(GTK_TABLE(table), combo, 0, 2, 12, 13, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
		gtk_widget_show(combo);

		hbox = gtk_hbox_new(FALSE, 6);
		cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
		g_signal_connect(G_OBJECT(cancel), "clicked", G_CALLBACK(cancel_clicked), NULL);
		gtk_box_pack_start(GTK_BOX(hbox), pb, TRUE, TRUE, 0);
		gtk_box_pack_start(GTK_BOX(hbox), cancel, FALSE, TRUE, 0);

		gtk_table_attach(GTK_TABLE(table), hbox, 0, 2, 13, 14, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
		g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(serverstats_combo_changed), pb);

		sw = gtk_scrolled_window_new(NULL, NULL);
		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
		gtk_container_set_border_width(GTK_CONTAINER(sw), 6);

		store = gtk_list_store_new(4, G_TYPE_ULONG, G_TYPE_STRING, G_TYPE_ULONG, G_TYPE_STRING);
		gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0, GTK_SORT_DESCENDING);
		serverstats_tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
		gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(serverstats_tree), FALSE);
		gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(serverstats_tree), TRUE);
		renderer = gtk_cell_renderer_text_new();
		g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, "width-chars", 30,
					 NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(serverstats_tree), -1, "", renderer, "text", 1, NULL);
		renderer = gtk_cell_renderer_progress_new();
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(serverstats_tree),
													-1, "", renderer, "value", 2, "text", 3, NULL);

		gtk_tree_view_set_search_column(GTK_TREE_VIEW(serverstats_tree), 1);

		gtk_container_add(GTK_CONTAINER(sw), serverstats_tree);

		gtk_table_attach(GTK_TABLE(table), sw, 0, 2, 14, 15, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
		gtk_widget_show_all(sw);
	}
	/**
     * Add table
     */
	gtk_box_pack_start(GTK_BOX(serverstats_vbox), table, TRUE, TRUE, 0);
	/* maintain my own reference to the widget, so it won't get destroyed removing 
	 * from view
	 */
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(serverstats_sw), serverstats_event);
	gtk_widget_show(serverstats_vbox);
	gtk_widget_show(serverstats_event);
	gtk_widget_show(serverstats_sw);
	g_object_ref_sink(serverstats_sw);
}
Example #16
0
void create_win1_gui()
{
  if (frame)
    return;
//  dbg("create_win1_gui %s\n", wselkey);

  win1_rowN = (wselkeyN + pho_candicate_col_N - 1 ) / pho_candicate_col_N;

  frame = gtk_frame_new(NULL);
  gtk_container_add (GTK_CONTAINER(gwin1), frame);

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

  GtkWidget *eve_box_up = gtk_event_box_new();
  gtk_event_box_set_visible_window (GTK_EVENT_BOX(eve_box_up), FALSE);
  gtk_box_pack_start (GTK_BOX (vbox_top), eve_box_up, FALSE, FALSE, 0);
  arrow_up = gtk_arrow_new (GTK_ARROW_UP, GTK_SHADOW_IN);
  gtk_container_add(GTK_CONTAINER(eve_box_up), arrow_up);
  g_signal_connect (G_OBJECT (eve_box_up), "button-press-event",
                      G_CALLBACK (cb_arrow_up), NULL);

  int c_rowN = (wselkeyN + pho_candicate_col_N - 1) / pho_candicate_col_N * pho_candicate_col_N;
  int tablecolN = pho_candicate_col_N;

  if (!tsin_tail_select_key)
    tablecolN *= 2;

  c_config = current_config();

  GtkWidget *table = gtk_table_new(c_rowN, tablecolN, FALSE);
  gtk_box_pack_start (GTK_BOX (vbox_top), table, FALSE, FALSE, 0);

  int i;
  for(i=0; i < wselkeyN; i++)
  {
	int y = idx_to_y(i);
	int x = idx_to_x(i);

    if (!tsin_tail_select_key)
      x*=2;

    GtkWidget *align = gtk_alignment_new(0,0,0,0);
    gtk_table_attach_defaults(GTK_TABLE(table),align, x,x+1,y,y+1);
    GtkWidget *event_box_pho = gtk_event_box_new();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_pho), FALSE);
    GtkWidget *label = gtk_label_new(NULL);
    gtk_container_add (GTK_CONTAINER (event_box_pho), label);
    labels_sele[i] = label;
    eve_sele[i] = event_box_pho;
    gtk_container_add (GTK_CONTAINER (align), event_box_pho);
    gtk_label_set_justify(GTK_LABEL(labels_sele[i]),GTK_JUSTIFY_LEFT);
    set_label_font_size(labels_sele[i], gcin_font_size_tsin_presel);
    g_signal_connect(G_OBJECT(event_box_pho),"button-press-event",
                   G_CALLBACK(mouse_button_callback), GINT_TO_POINTER(i));

    if (!tsin_tail_select_key) {
      GtkWidget *alignR = gtk_alignment_new(0,0,0,0);
      gtk_table_attach_defaults(GTK_TABLE(table), alignR, x+1,x+2,y,y+1);
      GtkWidget *event_box_phoR = gtk_event_box_new();
      gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_phoR), FALSE);
      GtkWidget *labelR = gtk_label_new(NULL);
      gtk_container_add (GTK_CONTAINER (event_box_phoR), labelR);
      labels_seleR[i] = labelR;
      eve_seleR[i] = event_box_phoR;
      gtk_container_add (GTK_CONTAINER (alignR), event_box_phoR);
      gtk_label_set_justify(GTK_LABEL(labels_sele[i]),GTK_JUSTIFY_LEFT);
      set_label_font_size(labels_seleR[i], gcin_font_size_tsin_presel);
      g_signal_connect(G_OBJECT(event_box_phoR),"button-press-event",
                     G_CALLBACK(mouse_button_callback), GINT_TO_POINTER(i));
    }
  }

  GtkWidget *eve_box_down = gtk_event_box_new();
  gtk_event_box_set_visible_window (GTK_EVENT_BOX(eve_box_down), FALSE);
  gtk_box_pack_start (GTK_BOX (vbox_top), eve_box_down, FALSE, FALSE, 0);
  arrow_down = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
  gtk_container_add(GTK_CONTAINER(eve_box_down), arrow_down);
  g_signal_connect (G_OBJECT (eve_box_down), "button-press-event",
                      G_CALLBACK (cb_arrow_down), NULL);

  gtk_widget_show_all(gwin1);
//  gdk_flush();
  gtk_widget_hide(gwin1);

  change_win1_font();
}
Example #17
0
void gPanel::create(void)
{
	int i;
	GtkWidget *ch, *box;
	bool doReparent = false;
	bool was_visible = isVisible();
	GdkRectangle rect;
	int bg, fg;
	gControl *nextSibling;
	
	if (border)
	{
		getGeometry(&rect);
		bg = background();
		fg = foreground();
		nextSibling = next();
		parent()->remove(this);
		
		for (i = 0; i < childCount(); i++)
		{
			ch = child(i)->border;
			g_object_ref(G_OBJECT(ch));
			gtk_container_remove(GTK_CONTAINER(widget), ch);
		}
		
		_no_delete = true;
		gtk_widget_destroy(border);
		_no_delete = false;
		doReparent = true;
	}
	
	if (_bg_set)
	{
		border = gtk_event_box_new();
		widget = gtk_fixed_new();
		box = widget;
		//gtk_widget_set_app_paintable(border, TRUE);
		//gtk_widget_set_app_paintable(box, TRUE);
	}
	else
	{
		border = widget = gtk_fixed_new();
		box = NULL;
	}

	frame = widget;
	realize(true);
	
	//g_signal_connect(G_OBJECT(border), "size-allocate", G_CALLBACK(cb_size), (gpointer)this);
	//g_signal_connect(G_OBJECT(border), "expose-event", G_CALLBACK(cb_expose), (gpointer)this);
	
	if (doReparent)
	{
		if (box)
			gtk_widget_realize(box);
		
		setNext(nextSibling);
		setBackground(bg);
		setForeground(fg);
		updateFont();
		bufX = bufY = bufW = bufH = -1;
		setGeometry(&rect);
		
		for (i = 0; i < childCount(); i++)
		{
			ch = child(i)->border;
			gtk_container_add(GTK_CONTAINER(widget), ch);
			moveChild(child(i), child(i)->x(), child(i)->y());
			g_object_unref(G_OBJECT(ch));
		}
		
		if (was_visible)
			show();
		else
			hide();
		
		//gApplication::checkHoveredControl(this);
		
		if (_inside)
		{
			_inside = false;
			if (gApplication::_enter == this)
				gApplication::_enter = NULL;
			gApplication::_ignore_until_next_enter = this;
		}
	}
}
Example #18
0
static void ihm_VideoFullScreen(GtkWidget *widget, gpointer data) {
  int w, h;

  if (fullscreen != NULL) {
    printf("   Already fullscreen\n");
    return;
  }
  printf("   Go Fullscreen\n");

  /* Builds the image */
  fullscreen_image = (GtkImage*) gtk_image_new();
  fullscreen_eventbox = gtk_event_box_new();
  //align = gtk_alignment_new(0.5f,0.5f,0.0f,0.0f);


  /* Add three buttons on the fullscreen window */
  ihm_fullScreenHBox = gtk_hbox_new(FALSE, 0);

  ihm_fullScreenButton[0] = gtk_button_new_with_label(ihm_ImageButtonCaption[RAW_CAPTURE_BUTTON]);
  g_signal_connect(G_OBJECT(ihm_fullScreenButton[0]), "clicked", (GCallback) ihm_RAWCapture, NULL);
  gtk_container_add(GTK_CONTAINER(ihm_fullScreenHBox), ihm_fullScreenButton[0]);

  ihm_fullScreenButton[1] = gtk_button_new_with_label(ihm_ImageButtonCaption[ZAPPER_BUTTON]);
  g_signal_connect(G_OBJECT(ihm_fullScreenButton[1]), "clicked", (GCallback) ihm_Zapper, NULL);
  gtk_container_add(GTK_CONTAINER(ihm_fullScreenHBox), ihm_fullScreenButton[1]);

  ihm_fullScreenButton[2] = gtk_button_new_with_label("Quit Fullscreen");
  g_signal_connect(G_OBJECT(ihm_fullScreenButton[2]), "clicked", (GCallback) ihm_QuitFullscreenRequest, NULL);
  gtk_container_add(GTK_CONTAINER(ihm_fullScreenHBox), ihm_fullScreenButton[2]);

  //ihm_fullScreenButton[3] = gtk_button_new(); // Fake button

  //gtk_container_add(GTK_CONTAINER (align),ihm_fullScreenHBox);

  /* Create window (full screen) */
  fullscreen_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  /* the screen */
  fullscreen = gtk_window_get_screen(GTK_WINDOW(fullscreen_window));
  w = gdk_screen_get_width(fullscreen);
  h = gdk_screen_get_height(fullscreen);
  gtk_widget_set_size_request(GTK_WIDGET(fullscreen_window), w, h);

  /* The fixed container */
  ihm_fullScreenFixedContainer = gtk_fixed_new();
  gtk_fixed_put((GtkFixed*) (ihm_fullScreenFixedContainer), GTK_WIDGET(fullscreen_image), 0, 0);
  gtk_fixed_put((GtkFixed*) (ihm_fullScreenFixedContainer), GTK_WIDGET(ihm_fullScreenHBox), 0, 0);

  /* Build the fullscreen window with the fixed container */
  gtk_container_add(GTK_CONTAINER(fullscreen_eventbox), ihm_fullScreenFixedContainer);
  gtk_container_add(GTK_CONTAINER(fullscreen_window), fullscreen_eventbox);

  gtk_window_set_decorated(GTK_WINDOW(fullscreen_window), FALSE);
  gtk_window_set_resizable(GTK_WINDOW(fullscreen_window), FALSE);

  printf("Fullscreen size : %ix%i\n", w, h);

  g_signal_connect(G_OBJECT(fullscreen_window), "destroy", (GCallback) ihm_VideoFullScreenStop, NULL);
  g_signal_connect(fullscreen_eventbox, "motion_notify_event", (GCallback) ihm_VideoFullScreenMouseMove, NULL);
  gtk_widget_add_events(fullscreen_eventbox, GDK_POINTER_MOTION_MASK);

  gtk_window_fullscreen(GTK_WINDOW(fullscreen_window));
  gtk_widget_show_all(GTK_WIDGET(fullscreen_window));
  gtk_widget_hide(ihm_fullScreenHBox);
  //gtk_widget_get_size_request(ihm_fullScreenHBox,&w2,&h2);
  //printf("Fullscreen size2 : %ix%i    %ix%i\n",w,h,w2,h2);

  //gtk_fixed_put(ihm_fullScreenFixedContainer,ihm_fullScreenHBox,0,h-30);

  if (!flag_timer_is_active) {
    g_timeout_add(1000, (GtkFunction) hide_fullscreen_buttons, NULL);
    flag_timer_is_active = 1;
  }

}
Example #19
0
File: maemo.c Project: CSRedRat/vlc
/*****************************************************************************
* Initialize and launch the interface
*****************************************************************************/
static void *Thread( void *obj )
{
    intf_thread_t *p_intf = (intf_thread_t *)obj;
    const char *p_args[] = { "vlc" };
    int i_args = sizeof(p_args)/sizeof(char *);
    char **pp_args  = (char **)p_args;

    HildonProgram *program;
    HildonWindow *window;
    GtkWidget *main_vbox, *bottom_hbox;
    GtkWidget *video, *seekbar;
    GtkWidget *play_button, *prev_button, *next_button;
    GtkWidget *stop_button, *playlist_button;

    gtk_init( &i_args, &pp_args );

    program = HILDON_PROGRAM( hildon_program_get_instance() );
    g_set_application_name( "VLC Media Player" );

    window = HILDON_WINDOW( hildon_window_new() );
    hildon_program_add_window( program, window );
    gtk_object_set_data( GTK_OBJECT( window ), "p_intf", p_intf );
    p_intf->p_sys->p_main_window = window;

    g_signal_connect( GTK_WIDGET(window), "key-press-event",
                      G_CALLBACK( key_cb ), p_intf );
    g_signal_connect (GTK_WIDGET(window), "delete_event",
                      GTK_SIGNAL_FUNC( quit_event), p_intf );

    // A little theming
    char *psz_rc_file = NULL;
    char *psz_data = config_GetDataDir( p_intf );
    if( asprintf( &psz_rc_file, "%s/maemo/vlc_intf.rc", psz_data ) != -1 )
    {
        gtk_rc_parse( psz_rc_file );
        free( psz_rc_file );
    }
    free( psz_data );

    // We create the main vertical box
    main_vbox = gtk_vbox_new( FALSE, 0 );
    gtk_container_add( GTK_CONTAINER( window ), main_vbox );

    // Menubar
    GtkWidget *main_menu = create_menu( p_intf );
#ifdef HAVE_MAEMO
    hildon_window_set_menu( HILDON_WINDOW( p_intf->p_sys->p_main_window ),
                            GTK_MENU( main_menu ) );
#else
    GtkWidget *menu_bar = gtk_menu_bar_new ();
    GtkWidget *item = gtk_menu_item_new_with_label ("Menu");
    gtk_menu_bar_append(menu_bar, item);
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), main_menu);
    gtk_widget_show_all (menu_bar);
    gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, FALSE, 0);
#endif

    // We put first the embedded video
    video = gtk_event_box_new();
    GdkColor black = {0,0,0,0};
    gtk_widget_modify_bg(video, GTK_STATE_NORMAL, &black);
    p_intf->p_sys->p_video_window = video;
    gtk_box_pack_start( GTK_BOX( main_vbox ), video, TRUE, TRUE, 0 );

    create_playlist( p_intf );
    gtk_box_pack_start( GTK_BOX( main_vbox ), p_intf->p_sys->p_playlist_window, TRUE, TRUE, 0 );

    // We put the horizontal box which contains all the buttons
    p_intf->p_sys->p_control_window = bottom_hbox = gtk_hbox_new( FALSE, 0 );

    // We create the buttons
    play_button = gtk_button_new();
    gtk_button_set_image( GTK_BUTTON( play_button ),
                   gtk_image_new_from_stock( "vlc-play", GTK_ICON_SIZE_BUTTON ) );
    p_intf->p_sys->p_play_button = play_button;
    stop_button = gtk_button_new();
    gtk_button_set_image( GTK_BUTTON( stop_button ),
                          gtk_image_new_from_stock( "vlc-stop", GTK_ICON_SIZE_BUTTON ) );
    prev_button = gtk_button_new();
    gtk_button_set_image( GTK_BUTTON( prev_button ),
                      gtk_image_new_from_stock( "vlc-previous", GTK_ICON_SIZE_BUTTON ) );
    next_button = gtk_button_new();
    gtk_button_set_image( GTK_BUTTON( next_button ),
                      gtk_image_new_from_stock( "vlc-next", GTK_ICON_SIZE_BUTTON ) );
    playlist_button = gtk_button_new();
    gtk_button_set_image( GTK_BUTTON( playlist_button ),
                          gtk_image_new_from_stock( "vlc-playlist", GTK_ICON_SIZE_BUTTON ) );
    seekbar = hildon_seekbar_new();
    p_intf->p_sys->p_seekbar = HILDON_SEEKBAR( seekbar );

    // We add them to the hbox
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), play_button, FALSE, FALSE, 0 );
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), stop_button, FALSE, FALSE, 0 );
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), prev_button, FALSE, FALSE, 0 );
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), next_button, FALSE, FALSE, 0 );
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), playlist_button, FALSE, FALSE, 0 );
    gtk_box_pack_start( GTK_BOX( bottom_hbox ), seekbar    , TRUE , TRUE , 5 );
    // We add the hbox to the main vbox
    gtk_box_pack_start( GTK_BOX( main_vbox ), bottom_hbox, FALSE, FALSE, 0 );

    g_signal_connect( play_button, "clicked", G_CALLBACK( play_cb ), NULL );
    g_signal_connect( stop_button, "clicked", G_CALLBACK( stop_cb ), NULL );
    g_signal_connect( prev_button, "clicked", G_CALLBACK( prev_cb ), NULL );
    g_signal_connect( next_button, "clicked", G_CALLBACK( next_cb ), NULL );
    g_signal_connect( playlist_button, "clicked", G_CALLBACK( playlist_cb ), NULL );
    g_signal_connect( seekbar, "change-value",
                      G_CALLBACK( seekbar_changed_cb ), NULL );

    gtk_widget_show_all( GTK_WIDGET( window ) );
    gtk_widget_hide_all( p_intf->p_sys->p_playlist_window );

#if 1
    /* HACK: Only one X11 client can subscribe to mouse button press events.
     * VLC currently handles those in the video display.
     * Force GTK to unsubscribe from mouse press and release events. */
    Display *dpy = GDK_WINDOW_XDISPLAY( gtk_widget_get_window(p_intf->p_sys->p_video_window) );
    Window w = GDK_WINDOW_XID( gtk_widget_get_window(p_intf->p_sys->p_video_window) );
    XWindowAttributes attr;

    XGetWindowAttributes( dpy, w, &attr );
    attr.your_event_mask &= ~(ButtonPressMask|ButtonReleaseMask);
    XSelectInput( dpy, w, attr.your_event_mask );
#endif

    // The embedded video is only ready after gtk_main and windows are shown
    g_idle_add( interface_ready, p_intf );

    gtk_main();

    delete_input( p_intf );
    delete_playlist( p_intf );

    gtk_object_destroy( GTK_OBJECT( main_menu ) );
    gtk_object_destroy( GTK_OBJECT( window ) );

    return NULL;
}
Example #20
0
static struct vi_x86_core_board_t *vi_x86_core_board_create(struct vi_x86_core_t *core)
{
    struct vi_x86_core_board_t *board;

    char str[MAX_STRING_SIZE];

    /* Allocate */
    board = calloc(1, sizeof(struct vi_x86_core_board_t));
    if (!board)
        fatal("%s: out of memory", __FUNCTION__);

    /* Initialize */
    board->core = core;

    /* Frame */
    GtkWidget *frame = gtk_frame_new(NULL);
    GtkWidget *event_box = gtk_event_box_new();
    gtk_container_add(GTK_CONTAINER(event_box), frame);
    gtk_widget_set_size_request(frame, VI_X86_CORE_BOARD_WIDTH, VI_X86_CORE_BOARD_HEIGHT);

    /* Vertical box */
    GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    gtk_container_add(GTK_CONTAINER(frame), vbox);

    /* Name */
    snprintf(str, sizeof str, "<b>%s</b>", core->name);
    GtkWidget *label = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(label), str);
    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 0);

    /* Horizontal box */
    GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);

    /* LED */
    struct vi_led_t *led = vi_led_create(13);
    gtk_box_pack_start(GTK_BOX(hbox), vi_led_get_widget(led), FALSE, TRUE, 0);
    board->led = led;

    /* Time Diagram Toggle button */
    GtkWidget *time_dia_toggle_button = gtk_toggle_button_new_with_label("Detail");
    gtk_box_pack_start(GTK_BOX(hbox), time_dia_toggle_button, TRUE, TRUE, 0);
    g_signal_connect(G_OBJECT(time_dia_toggle_button), "toggled",
                     G_CALLBACK(vi_x86_core_board_time_dia_toggled), board);
    board->time_dia_toggle_button = time_dia_toggle_button;

    /* Context list */
    struct vi_list_t *context_list = vi_list_create("Context list", 10, 10,
                                     (vi_list_get_elem_name_func_t) vi_x86_context_get_name_short,
                                     (vi_list_get_elem_desc_func_t) vi_x86_context_get_desc);
    gtk_box_pack_start(GTK_BOX(vbox), vi_list_get_widget(context_list), TRUE, TRUE, 0);
    board->context_list = context_list;

    /* Main widget */
    board->widget = event_box;
    g_signal_connect(G_OBJECT(board->widget), "destroy", G_CALLBACK(vi_x86_core_board_destroy), board);

    /* Return */
    return board;
}
static GtkWidget*
previews_of_button_layouts (void)
{
    static gboolean initted = FALSE;
    GtkWidget *box;
    GtkWidget *sw;
    GdkColor desktop_color;
    int i;
    GtkWidget *eventbox;

    if (!initted)
    {
        init_layouts ();
        initted = TRUE;
    }

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

    box = gtk_vbox_new (FALSE, 0);
    gtk_box_set_spacing (GTK_BOX (box), 20);
    gtk_container_set_border_width (GTK_CONTAINER (box), 20);

    eventbox = gtk_event_box_new ();
    gtk_container_add (GTK_CONTAINER (eventbox), box);

    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), eventbox);

    desktop_color.red = 0x5144;
    desktop_color.green = 0x75D6;
    desktop_color.blue = 0xA699;

    gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &desktop_color);

    i = 0;
    while (i < BUTTON_LAYOUT_COMBINATIONS)
    {
        GtkWidget *align;
        double xalign, yalign;
        GtkWidget *eventbox2;
        GtkWidget *preview;
        char *title;

        eventbox2 = gtk_event_box_new ();

        preview = meta_preview_new ();

        gtk_container_add (GTK_CONTAINER (eventbox2), preview);

        meta_preview_set_theme (META_PREVIEW (preview), global_theme);

        title = g_strdup_printf (_("Button layout test %d"), i+1);
        meta_preview_set_title (META_PREVIEW (preview), title);
        g_free (title);

        meta_preview_set_button_layout (META_PREVIEW (preview),
                                        &different_layouts[i]);

        xalign = 0.5;
        yalign = 0.5;

        align = gtk_alignment_new (0.0, 0.0, xalign, yalign);
        gtk_container_add (GTK_CONTAINER (align), eventbox2);

        gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0);

        previews[META_FRAME_TYPE_LAST*FONT_SIZE_LAST + i] = preview;

        ++i;
    }

    return sw;
}
Example #22
0
void calc_event (GtkWidget *widget,
				 gpointer data )
{
	int i, j;
	char s[100], temp[10][50];

	/*分割参数 并运行计算程序*/	
	strcpy(s, gtk_entry_get_text(GTK_ENTRY(data)));
	i = j = 0;
	while(1)
	{
		sscanf(&s[j], " %s", temp[++i]);
		while(s[j] == ' ')j++;
		j += strlen(temp[i]);
		if(s[j] == '\0')break;
	}
	sprintf(s, "./2");
	for(j = 1; j <= i; j ++)
	{
		strcat(s, " ");
		strcat(s, temp[j]);
	}
	printf("%s\n", s);
	system(s);

	/*读入数据*/
	fin = fopen ("data", "r");
	fscanf(fin, "%d%d%d", &ans, &row, &colunm);
	for(i = 1; i <= row; i ++)
		for(j = 1; j <= colunm; j ++)
			fscanf(fin, "%d", &a[i][j]);

	for(i = 1; i <= row; i ++)
		for(j = 1; j <= colunm; j ++)
			fscanf(fin, "%d", &used[i][j]);
	fclose(fin);
	

	/*创建分页*/
	GdkColor color;

	table = gtk_table_new (row, colunm, TRUE);

	sprintf(s, "answer=%d", ans);
	label = gtk_label_new(s);

	button = gtk_button_new_with_label("x");
	g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_current_page), notebook);

	hbox = gtk_hbox_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 3);
	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 3);

	gtk_notebook_append_page (GTK_NOTEBOOK(notebook), table, hbox);
	/*注意notebook的tab_label并不会随gtk_widget_show_all(notebook)一起show,需要单独show*/	
	gtk_widget_show_all(hbox);

	for(i = 1; i <= row; i ++)
	{
		for(j = 1; j <= colunm; j ++)
		{
			event_box = gtk_event_box_new ();

			color.red = 0xffff;
			color.green = 0xffff;
			if(used[i][j] == 1)
				color.blue = 0x0000;    
			else
				color.blue = 0xffff;

			gtk_widget_modify_bg(event_box,GTK_STATE_NORMAL, &color);
			gtk_table_attach_defaults (GTK_TABLE(table), event_box, j-1, j, i-1, i);

			sprintf(s, "%d", a[i][j]);
			label = gtk_label_new (s);
			gtk_container_add(GTK_CONTAINER(event_box), label);		

			gtk_widget_show (label);
			gtk_widget_show (event_box);
		}
	}
	gtk_widget_show(table);
	gtk_widget_show(window);

	gtk_widget_show_all(notebook);
}
Example #23
0
/* desktopicon_new_do */
static DesktopIcon * _desktopicon_new_do(Desktop * desktop, GdkPixbuf * image,
		char const * name)
{
	DesktopIcon * desktopicon;
	GtkWindow * window;
	GtkWidget * vbox;
	GdkGeometry geometry;

	if((desktopicon = malloc(sizeof(*desktopicon))) == NULL)
		return NULL;
	memset(desktopicon, 0, sizeof(*desktopicon));
	desktopicon->desktop = desktop;
	desktopicon->confirm = TRUE;
	desktopicon->updated = TRUE;
	/* window */
	desktopicon->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	window = GTK_WINDOW(desktopicon->window);
	gtk_window_set_decorated(window, FALSE);
#if GTK_CHECK_VERSION(2, 6, 0)
	gtk_window_set_focus_on_map(window, FALSE);
#endif
	gtk_window_set_keep_below(window, TRUE);
	gtk_window_set_resizable(window, FALSE);
	gtk_window_set_skip_pager_hint(window, TRUE);
#ifdef EMBEDDED
	gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_UTILITY);
#else
	gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DOCK);
#endif
	g_signal_connect(G_OBJECT(desktopicon->window), "delete-event",
			G_CALLBACK(_on_desktopicon_closex), NULL);
	/* event */
	desktopicon->event = gtk_event_box_new();
	g_signal_connect(G_OBJECT(desktopicon->event), "button-press-event",
			G_CALLBACK(_on_icon_button_press), desktopicon);
	g_signal_connect(G_OBJECT(desktopicon->event), "key-press-event",
			G_CALLBACK(_on_icon_key_press), desktopicon);
	vbox = gtk_vbox_new(FALSE, 4);
	geometry.min_width = DESKTOPICON_MIN_WIDTH;
	geometry.min_height = DESKTOPICON_MIN_HEIGHT;
	geometry.max_width = DESKTOPICON_MAX_WIDTH;
	geometry.max_height = DESKTOPICON_MAX_HEIGHT;
	geometry.base_width = DESKTOPICON_MIN_WIDTH;
	geometry.base_height = DESKTOPICON_MIN_HEIGHT;
	gtk_window_set_geometry_hints(window, vbox, &geometry, /* XXX check */
			GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE
			| GDK_HINT_BASE_SIZE);
	/* image */
	desktopicon->image = gtk_image_new();
	gtk_widget_set_size_request(desktopicon->image, DESKTOPICON_ICON_SIZE,
			DESKTOPICON_ICON_SIZE);
	gtk_box_pack_start(GTK_BOX(vbox), desktopicon->image, FALSE, TRUE, 0);
	/* label */
	desktopicon->label = gtk_label_new(NULL);
	gtk_misc_set_alignment(GTK_MISC(desktopicon->label), 0.5, 0.0);
#if GTK_CHECK_VERSION(2, 10, 0)
	gtk_label_set_line_wrap_mode(GTK_LABEL(desktopicon->label),
			PANGO_WRAP_WORD_CHAR);
#endif
	gtk_label_set_line_wrap(GTK_LABEL(desktopicon->label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), desktopicon->label, TRUE, TRUE, 4);
	gtk_container_add(GTK_CONTAINER(desktopicon->event), vbox);
	gtk_container_add(GTK_CONTAINER(desktopicon->window),
			desktopicon->event);
	if(image == NULL)
		image = desktop_get_file(desktop);
	_desktopicon_set_icon(desktopicon, image);
	_desktopicon_set_name(desktopicon, name);
	_desktopicon_update_transparency(desktopicon);
	return desktopicon;
}
Example #24
0
/**
 * gens_window_create(): Create the Gens window.
 */
void gens_window_create(void)
{
	// Create the icon for the Gens window, and set it as default for all windows.
	// TODO: Move this to a common C file.
	
	// TODO: Use the standard icon directory layout.
	GList *gens_icon_list = NULL;
	static const char* const gens_icon_filename[3] =
	{
		GENS_DATADIR "/gensgs_48x48.png",
		GENS_DATADIR "/gensgs_32x32.png",
		GENS_DATADIR "/gensgs_16x16.png"
	};
	
	// Add the icons.
	for (int i = 0; i < 3; i++)
	{
		if (!g_file_test(gens_icon_filename[i], G_FILE_TEST_EXISTS))
		{
			// File not found.
			LOG_MSG(gens, LOG_MSG_LEVEL_WARNING,
				"Image file not found: %s",
				gens_icon_filename[i]);
			continue;
		}
		
		// Load the icon.
		GError *error = NULL;
		GdkPixbuf *gens_icon = gdk_pixbuf_new_from_file(gens_icon_filename[i], &error);
		if (!gens_icon)
		{
			LOG_MSG(gens, LOG_MSG_LEVEL_WARNING,
				"Error loading image file %s: %s",
				gens_icon_filename[i], error->message);
			g_error_free(error);
			continue;
		}
		
		// Add the icon to the icon list.
		gens_icon_list = g_list_append(gens_icon_list, gens_icon);
	}
	
	// Set the icon list as the default icon list.
	gtk_window_set_default_icon_list(gens_icon_list);
	
	// Free the icon list.
	g_list_free(gens_icon_list);
	
	// Create the Gens window.
	gens_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_resizable(GTK_WINDOW(gens_window), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(gens_window), 0);
	gtk_window_set_position(GTK_WINDOW(gens_window), GTK_WIN_POS_CENTER);
	gtk_window_set_title(GTK_WINDOW(gens_window), "Gens");
	
	// Create the main VBox.
	gens_vbox_main = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(gens_vbox_main);
	gtk_container_add(GTK_CONTAINER(gens_window), gens_vbox_main);
	
	// Create the HBox for the SDL "socket".
	GtkWidget *hboxSocket = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(hboxSocket);
	gtk_box_pack_end(GTK_BOX(gens_vbox_main), hboxSocket, TRUE, TRUE, 0);
	
	// Create the SDL "socket".
	gens_window_sdlsock = gtk_event_box_new();
	gtk_box_pack_start(GTK_BOX(hboxSocket), gens_window_sdlsock, TRUE, FALSE, 0);
	
	// Set the background color of the SDL "socket" to black.
	GdkColor bg = {0, 0, 0, 0};
	gtk_widget_modify_bg(gens_window_sdlsock, GTK_STATE_NORMAL, &bg);
	
	// Callbacks for if the window is closed.
	g_signal_connect((gpointer)gens_window, "delete-event",
			 G_CALLBACK(on_gens_window_close), NULL);
	g_signal_connect((gpointer)gens_window, "destroy-event",
			 G_CALLBACK(on_gens_window_close), NULL);
	
	// Callbacks for Auto Pause.
	g_signal_connect((gpointer)gens_window, "focus-in-event",
			 G_CALLBACK(gens_window_focus_in), NULL);
	g_signal_connect((gpointer)gens_window, "focus-out-event",
			 G_CALLBACK(gens_window_focus_out), NULL);
	
	// Enable drag & drop for ROM loading.
	static const GtkTargetEntry target_list[] =
	{
		{"text/plain", 0, 0},
		{"text/uri-list", 0, 1},
	};
	
	gtk_drag_dest_set
	(
		gens_window_sdlsock,
		(GtkDestDefaults)(GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT),
		target_list,
		G_N_ELEMENTS(target_list),
		(GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE | GDK_ACTION_ASK)
	);
	
	// Set drag & drop callbacks.
	g_signal_connect(gens_window_sdlsock, "drag-data-received",
			 G_CALLBACK(gens_window_drag_data_received), NULL);
	g_signal_connect(gens_window_sdlsock, "drag-drop",
			 G_CALLBACK(gens_window_drag_drop), NULL);
	
	// Expose event.
	g_signal_connect(gens_window_sdlsock, "expose-event",
			 G_CALLBACK(gens_window_sdlsock_expose), NULL);
	
	// Button Press event.
	g_signal_connect(gens_window_sdlsock, "button-press-event",
			 G_CALLBACK(gens_window_sdlsock_button_press), NULL);
	
	// Window State event.
	g_signal_connect(gens_window, "window-state-event",
			 G_CALLBACK(gens_window_window_state_event), NULL);
	
	// Window is active.
	Settings.Active = 1;
}
Example #25
0
Chattab *
ui_tab_create(const gchar *jid, const gchar *title, gint active)
{
	Chattab *tab;
	GtkWidget *evbox;
	tab = g_malloc(sizeof(Chattab));
	if(jid == NULL) {
		tab->jid = NULL;
		status_tab = tab;
	}
	else
		tab->jid = g_strdup(jid);
	tab->title = g_strdup(title);
	/* setting up a place for a tab title */
	evbox = gtk_event_box_new();
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(evbox), FALSE);
	tab->label = gtk_label_new(tab->title);
	gtk_container_add(GTK_CONTAINER(evbox), tab->label);
	gtk_widget_show(tab->label);
	g_signal_connect(G_OBJECT(evbox), "button-press-event",
	                 G_CALLBACK(tab_label_click_cb), (gpointer)tab);
	/* creating GtkTextView for status messages */
	tab->tview = gtk_text_view_new();
	tab->buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tab->tview));
	gtk_text_view_set_editable(GTK_TEXT_VIEW(tab->tview), FALSE);
	gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(tab->tview), FALSE);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tab->tview), GTK_WRAP_WORD);
	tab->mk = gtk_text_buffer_get_mark(tab->buffer, "insert");
	/* we're putting this in a scrolled window */
	tab->scrolled = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tab->scrolled),
	                               GTK_POLICY_AUTOMATIC,
	                               GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tab->scrolled),
	                                      tab->tview);
	/* setting up the entry field */
	if (jid) {
		tab->entry = mlentry_new(tab_entry_handler, tab);
		gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tab->entry), GTK_WRAP_WORD_CHAR);
		gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(tab->entry), FALSE);
	}
	/* some vbox to put it together */
	tab->vbox = gtk_vpaned_new();
	/* this will help us finding Chattab struct by some of its properties */
	g_object_set_data(G_OBJECT(tab->vbox), "chattab-data", tab);
	/* now let's put it all together */
	gtk_paned_pack1(GTK_PANED(tab->vbox), tab->scrolled, TRUE, FALSE);
	if(jid) {
		gtk_paned_pack2(GTK_PANED(tab->vbox), tab->entry, FALSE, FALSE);
	}
	gtk_widget_show_all(tab->vbox);
	/* aaand, launch! */
	gtk_notebook_append_page(GTK_NOTEBOOK(nbook), tab->vbox, evbox);
	tabs = g_slist_prepend(tabs, tab);
	if(active && jid) {
		gtk_notebook_set_current_page(GTK_NOTEBOOK(nbook),
	       	                              gtk_notebook_page_num(GTK_NOTEBOOK(nbook),
	                                                            tab->vbox));
		gtk_widget_grab_focus(tab->entry);
	}
	return tab;
} /* ui_tab_create */
Example #26
0
static void file_info_box_build()
{
	GtkWidget *hbox1, *vbox1;
	GtkWidget *info_exit, *info_mute;
	GtkWidget *info_unmute, *info_about;
	GtkWidget *scrw1;
	GtkWidget *expander;
	GdkVisual *visual;
	PangoFontDescription *desc;

	info_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_object_set_data(GTK_OBJECT(info_window),
					"info_window", info_window);
	gtk_window_set_title(GTK_WINDOW(info_window),"Extended Module Player");
	gtk_window_set_policy(GTK_WINDOW(info_window), FALSE, FALSE, TRUE);
	gtk_signal_connect(GTK_OBJECT(info_window), "destroy",
		GTK_SIGNAL_FUNC(gtk_widget_destroyed), &info_window);
	gtk_container_border_width(GTK_CONTAINER(info_window), 0);
	gtk_widget_realize (info_window);

	vbox1 = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(info_window), vbox1);
	gtk_object_set_data(GTK_OBJECT(vbox1), "vbox1", vbox1);
	gtk_container_border_width(GTK_CONTAINER(vbox1), 4);

	visual = gdk_visual_get_system();

	/*
	 * Image
	 */

	frame1 = gtk_event_box_new();
	gtk_object_set_data(GTK_OBJECT(frame1), "frame1", frame1);
	gtk_widget_set_size_request(frame1, 300, 128);
	gtk_box_pack_start(GTK_BOX(vbox1), frame1, FALSE, FALSE, 0);

	image = gdk_image_new(GDK_IMAGE_FASTEST, visual, 300, 128);
	ximage = GDK_IMAGE_XIMAGE(image);
	image1 = gtk_image_new_from_image(image, NULL);

	gtk_object_set_data(GTK_OBJECT(image1), "image1", image1);
	gtk_container_add (GTK_CONTAINER(frame1), image1);
	gtk_widget_set_events (frame1, GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK);
	gtk_signal_connect (GTK_OBJECT (frame1), "button_press_event",
			(GtkSignalFunc)image1_clicked, NULL);

	/*
	 * Buttons
	 */

	hbox1 = gtk_hbox_new (TRUE, 0);
	gtk_object_set_data(GTK_OBJECT(hbox1), "hbox1", hbox1);
	gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, FALSE, 0);

	info_mute = gtk_button_new_with_label("Mute");
	gtk_signal_connect (GTK_OBJECT (info_mute), "clicked",
                            (GtkSignalFunc) button_mute, NULL);
	gtk_object_set_data(GTK_OBJECT(info_mute), "info_mute", info_mute);
	gtk_box_pack_start(GTK_BOX(hbox1), info_mute, TRUE, TRUE, 0);

	info_unmute = gtk_button_new_with_label("Unmute");
	gtk_signal_connect (GTK_OBJECT (info_unmute), "clicked",
                            (GtkSignalFunc) button_unmute, NULL);
	gtk_object_set_data(GTK_OBJECT(info_unmute), "info_unmute", info_unmute);
	gtk_box_pack_start(GTK_BOX(hbox1), info_unmute, TRUE, TRUE, 0);

	info_about = gtk_button_new_with_label("About");
	gtk_signal_connect_object(GTK_OBJECT(info_about), "clicked",
			(GtkSignalFunc) aboutbox, NULL);
	gtk_object_set_data(GTK_OBJECT(info_about), "info_about", info_about);
	gtk_box_pack_start(GTK_BOX(hbox1), info_about, TRUE, TRUE, 0);

	info_exit = gtk_button_new_with_label("Close");
	gtk_signal_connect_object(GTK_OBJECT(info_exit), "clicked",
		GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(info_window));
	gtk_object_set_data(GTK_OBJECT(info_exit), "info_exit", info_exit);
	gtk_box_pack_start(GTK_BOX(hbox1), info_exit, TRUE, TRUE, 0);

	/*
	 * Info area
	 */

	expander = gtk_expander_new("Module information");

	scrw1 = gtk_scrolled_window_new(NULL, NULL);
	gtk_object_set_data(GTK_OBJECT(scrw1), "scrw1", scrw1);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrw1),
				GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);

	gtk_container_add(GTK_CONTAINER(expander), scrw1);
	gtk_box_pack_start(GTK_BOX(vbox1), expander, TRUE, TRUE, 0);

	gtk_widget_set_size_request(scrw1, 290, 200);
	text1b = gtk_text_buffer_new(NULL);
	text1 = gtk_text_view_new_with_buffer(text1b);
	desc = pango_font_description_new();
	pango_font_description_set_family(desc, "Monospace");
	gtk_widget_modify_font(text1, desc);
	pango_font_description_free(desc);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text1), GTK_WRAP_NONE);

	gtk_object_set_data(GTK_OBJECT(text1), "text1", text1);
	gtk_container_add(GTK_CONTAINER(scrw1), text1);
	gtk_widget_realize(text1);

	gtk_widget_realize(image1);

	display = GDK_WINDOW_XDISPLAY(info_window->window);
	window = GDK_WINDOW_XWINDOW(info_window->window);
    	colormap = gdk_colormap_get_system();

	gdk_color_black(colormap, color_black);
	gdk_color_white(colormap, color_white);

	init_visual(visual);

	set_palette();
	clear_screen();

	ii->wresult = 0;

	panel_setup();
	gtk_timeout_add(50, (GtkFunction)panel_loop, NULL);
}
Example #27
0
void create_win_pho_gui_simple()
{
//  dbg("create_win_pho .....\n");

  if (top_bin)
    return;

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);

  GtkWidget *event_box_pho;
  if (gtab_in_area_button)
	event_box_pho = gtk_button_new();
  else {
	event_box_pho = gtk_event_box_new();
	gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_pho), FALSE);
  }

  gtk_container_set_border_width (GTK_CONTAINER (event_box_pho), 0);

  if (gcin_inner_frame) {
    GtkWidget *frame = top_bin = gtk_frame_new(NULL);
    gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
    gtk_container_add (GTK_CONTAINER(gwin_pho), frame);
    gtk_container_add (GTK_CONTAINER (frame), vbox_top);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
  } else {
    gtk_container_add (GTK_CONTAINER(gwin_pho), vbox_top);
    top_bin = vbox_top;
  }


  GtkWidget *align = gtk_alignment_new (0, 0, 0, 0);
  label_pho_sele = gtk_label_new(NULL);

  if (!pho_in_row1) {
    gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (align), label_pho_sele);
  } else {
    GtkWidget *hbox_row1 = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row1, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox_row1), event_box_pho, FALSE, FALSE, 0);

    gtk_box_pack_start (GTK_BOX (hbox_row1), align, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (align), label_pho_sele);
  }


  hbox_row2 = gtk_hbox_new (FALSE, 0);
  /* This packs the button into the gwin_pho (a gtk container). */
  gtk_container_add (GTK_CONTAINER (vbox_top), hbox_row2);
  label_full = gtk_label_new(_(_L("全")));
  gtk_container_add (GTK_CONTAINER (hbox_row2), label_full);


  if (!pho_in_row1)
    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_pho, FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(event_box_pho),"button-press-event",
                   G_CALLBACK(mouse_button_callback), NULL);


  label_pho = gtk_label_new(NULL);

  GtkWidget *frame_pho;
  if (gtab_in_area_button) {
	gtk_container_add (GTK_CONTAINER (event_box_pho), label_pho);
  }
  else {
	frame_pho = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(frame_pho), GTK_SHADOW_OUT);
	gtk_container_add (GTK_CONTAINER (event_box_pho), frame_pho);
	gtk_container_set_border_width (GTK_CONTAINER (frame_pho), 0);
	gtk_container_add (GTK_CONTAINER (frame_pho), label_pho);
  }

  if (left_right_button_tips) {
#if GTK_CHECK_VERSION(2,12,0)
    gtk_widget_set_tooltip_text (event_box_pho, _(_L("左鍵符號,右鍵設定")));
#else
    GtkTooltips *button_gtab_tips = gtk_tooltips_new ();
    gtk_tooltips_set_tip (GTK_TOOLTIPS (button_gtab_tips), event_box_pho, _(_L("左鍵符號,右鍵設定")),NULL);
#endif
  }

  label_key_codes  = gtk_label_new(NULL);
  gtk_label_set_selectable(GTK_LABEL(label_key_codes), TRUE);
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_key_codes, FALSE, FALSE, 2);

  change_pho_font_size();

  gtk_widget_show_all (gwin_pho);

  gtk_widget_hide(label_key_codes);

  gtk_widget_hide(label_full);
}
static void menu_start_init (MenuStart *ms)
{
	GdkPixbuf *logo;
	gchar *text;
	GtkWidget *button;
	GtkWidget *image;
	GtkWidget *label;
	GtkStyle *style;
	GtkWidget *button_hbox;
	char *logo_path;

	ms->menu_is_shown = TRUE;

	ms->width = 400;
	ms->height = 480;

	ms->show_header = TRUE;
	ms->show_footer = TRUE;

	gtk_window_set_resizable (GTK_WINDOW (ms), FALSE);

	ms->frame = gtk_frame_new (NULL);
	gtk_frame_set_shadow_type (GTK_FRAME (ms->frame), GTK_SHADOW_OUT);

	ms->vbox = gtk_vbox_new (FALSE, 1);

	gtk_container_set_border_width (GTK_CONTAINER (ms->vbox), 0);

	ms->menu_ebox = gtk_event_box_new ();
	gtk_container_add (GTK_CONTAINER (ms->menu_ebox), ms->vbox);

	gtk_container_add (GTK_CONTAINER (ms->frame), ms->menu_ebox);
	gtk_container_add (GTK_CONTAINER (ms), ms->frame);

	logo_path = g_strdup (ICONDIR "/xfce4_xicon.png");

	logo = gdk_pixbuf_new_from_file (logo_path, NULL);
	g_free (logo_path);

	ms->small_header = create_menu_header (_("Xfce4 Panel Menu"));
	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->small_header, FALSE, TRUE, 0);
	gtk_widget_hide (ms->small_header);

	text = g_strdup_printf (_("Xfce4 Panel Menu"));
	ms->header = create_ms_header (ms);
	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->header, FALSE, FALSE, 0);
	g_object_unref (logo);
	g_free (text);

	ms->fsbrowser = fs_browser_new ();
	g_signal_connect (G_OBJECT (FS_BROWSER (ms->fsbrowser)->closebutton),
			  "clicked", G_CALLBACK (hide_fsbrowser_widget), ms);
	g_signal_connect (G_OBJECT (ms->fsbrowser),
			  "completed", G_CALLBACK (hide_cb), ms);
	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->fsbrowser, TRUE, TRUE, 0);

	ms->fstab = fs_tab_widget_new ();
	g_signal_connect (G_OBJECT (FS_TAB_WIDGET (ms->fstab)->closebutton),
			  "clicked", G_CALLBACK (hide_fstab_widget), ms);
	g_signal_connect (G_OBJECT (ms->fstab),
			  "completed", G_CALLBACK (hide_cb), ms);
	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->fstab, TRUE, TRUE, 0);

	ms->menu = menu_new ();
	g_signal_connect (G_OBJECT (MENU (ms->menu)->recentfilesbutton),
			  "clicked", G_CALLBACK (show_fsbrowser_widget_with_rf), ms);
	g_signal_connect (G_OBJECT (MENU (ms->menu)->fstabbutton),
			  "clicked", G_CALLBACK (show_fstab_widget), ms);
	g_signal_connect (G_OBJECT (MENU (ms->menu)->fsbrowserbutton),
			  "clicked", G_CALLBACK (show_fsbrowser_widget), ms);
	g_signal_connect (G_OBJECT (ms->menu),
			  "completed", G_CALLBACK (hide_cb), ms);
	g_signal_connect (G_OBJECT (ms->menu),
			  "getgrab", G_CALLBACK (get_grab_cb), ms);

	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->menu, TRUE, TRUE, 0);

	/* foot */

	ms->foot = gtk_hbox_new (FALSE, 2);
	gtk_container_set_border_width (GTK_CONTAINER (ms->foot), 3);
	ms->footbox = gtk_event_box_new ();
	gtk_container_add (GTK_CONTAINER (ms->footbox), ms->foot);
	style = gtk_widget_get_style (ms->footbox);
	gtk_widget_modify_bg (ms->footbox, GTK_STATE_NORMAL,
			      &style->bg[GTK_STATE_SELECTED]);
	g_signal_connect_after (G_OBJECT (ms->footbox), "style_set",
				G_CALLBACK (private_cb_eventbox_style_set),
				NULL);

	button = create_foot_button ("gtk-quit", _("Exit"),
				     G_CALLBACK (logout_cb), ms);
	gtk_box_pack_end (GTK_BOX (ms->foot), button, FALSE, FALSE, 1);

	button = create_foot_button ("gtk-dialog-authentication", _("Lock Screen"),
				     G_CALLBACK (lock_screen_cb), ms);
	gtk_box_pack_end (GTK_BOX (ms->foot), button, FALSE, FALSE, 1);

	button = create_foot_button ("gtk-refresh", _("Switch User"),
				     G_CALLBACK (switch_user_cb), ms);
	gtk_box_pack_end (GTK_BOX (ms->foot), button, FALSE, FALSE, 1);

	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->footbox, FALSE, TRUE, 0);

	gtk_widget_show (ms->header);
	gtk_widget_show_all (ms->footbox);

	ms->small_footer = create_menu_header (_("Xfce4 Panel Menu"));
	gtk_box_pack_start (GTK_BOX (ms->vbox), ms->small_footer, FALSE, TRUE, 0);
	gtk_widget_hide (ms->small_footer);

	show_menu_widget (ms->menu);

	g_signal_connect (G_OBJECT (ms), "button-press-event",
			  G_CALLBACK (button_press), NULL);

	gtk_widget_show (GTK_WIDGET (ms->vbox));
	gtk_widget_show (GTK_WIDGET (ms->frame));

	ms->lock_app = g_strdup ("xscreensaver-command --lock");
	ms->switch_app = g_strdup ("gdmflexiserver");
}
Example #29
0
static void
textures_switch_page (GtkNotebook *notebook, GtkWidget *page, guint page_num, const gchar *texture_path)
{
  if (page_num == 0 || g_array_index (textures_timestamps, time_t, page_num) > 0)
    return;

  // fix gtk2
  page = gtk_notebook_get_nth_page (notebook, page_num);

  gtk_container_set_border_width (GTK_CONTAINER (page), 0);
  gtk_widget_set_size_request (page, -1, 480);

  const gchar *category = gtk_notebook_get_tab_label_text(notebook, page);

  /* scrolled window */
  GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (page), scrolled_window, TRUE, TRUE, 0);
  gtk_widget_show (scrolled_window);

  /* table */
  gint rows = 5;
  gint cols = 3;
  GtkWidget *table = gtk_table_new (rows, cols, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_container_set_border_width (GTK_CONTAINER (table), 10);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
  gtk_widget_show (table);

  gint row = 1;
  gint col = 1;

  const gchar *gimp_dir = gimp_directory ();
  const gchar *texture_dir = g_build_filename (gimp_dir, texture_path, NULL);
  const gchar *path = g_build_filename (texture_dir, category, NULL);

  GDir *dir = g_dir_open (path, 0, NULL);
  if (dir)
  {
    const gchar *dir_ent;
    while (dir_ent = g_dir_read_name (dir))
    {
      if (is_hidden (dir_ent))
        continue;

      gchar *filename = g_build_filename (path, dir_ent, NULL);
      GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
      pixbuf = gdk_pixbuf_scale_simple (pixbuf, THUMBNAIL_SIZE, THUMBNAIL_SIZE, GDK_INTERP_BILINEAR);
      GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
      GtkWidget *event_box = gtk_event_box_new ();
      gtk_container_add (GTK_CONTAINER (event_box), image);
      gtk_widget_show (image);
      gtk_table_attach_defaults (GTK_TABLE (table), event_box, col - 1, col, row - 1, row);
      gtk_widget_show (event_box);

      col++;
      if (col > cols)
      {
        row++;
        col = 1;
      }

      g_signal_connect (event_box, "button_press_event", G_CALLBACK (custom_texture_press), filename);
    }
  }

  g_array_index (textures_timestamps, time_t, page_num) = time (NULL);
}
int main(int argc, char *argv[])
{

    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain(GETTEXT_PACKAGE);

    gtk_init(&argc, &argv);

    app = glade_xml_new(UIDIR "uda-postconfig.glade", NULL, NULL);
    win = glade_xml_get_widget(app, "uda_postconfig_win");
    ok_button = glade_xml_get_widget(app, "ok_button");
    net_conf = glade_xml_get_widget(app, "net_conf");
    gtk_widget_set_sensitive(ok_button, FALSE);
    main_vbox = glade_xml_get_widget(app, "main_vbox");
    event_box = gtk_event_box_new();
    title_label = gtk_label_new("");
    gtk_label_set_markup(GTK_LABEL(title_label),
			 _
			 ("<span size=\"x-large\" weight=\"bold\" foreground=\"white\">SYSTEM INFORMATION</span>"));
    gtk_container_add(GTK_CONTAINER(event_box), title_label);
    gtk_box_pack_start(GTK_BOX(main_vbox), event_box, FALSE, TRUE, 0);
    gtk_box_reorder_child(GTK_BOX(main_vbox), event_box, 0);
    gdk_color_parse("#7b96ad", &color);
    gtk_widget_modify_bg(event_box, GTK_STATE_NORMAL, &color);
    gtk_widget_set_size_request(GTK_WIDGET(title_label), -1, 40);
    help_tv = glade_xml_get_widget(app, "help_text_view");
    adm_img = glade_xml_get_widget(app, "image_superuser");
    gtk_image_set_from_file(GTK_IMAGE(adm_img), UIDIR "admin.png");
    comp_img = glade_xml_get_widget(app, "image_computer");
    gtk_image_set_from_file(GTK_IMAGE(comp_img), UIDIR "computer.png");
    soft_img = glade_xml_get_widget(app, "image_repo");
    gtk_image_set_from_file(GTK_IMAGE(soft_img), UIDIR "software.png");
    name_entry = glade_xml_get_widget(app, "root_name_entry");

    passwd_entry = glade_xml_get_widget(app, "root_passwd_entry");
    passwd2_entry = glade_xml_get_widget(app, "root_passwd2_entry");
    cname_entry = glade_xml_get_widget(app, "computer_name_entry");
    screen = gdk_screen_get_default();
    gtk_widget_set_size_request(help_tv,
				gdk_screen_get_width(screen) * 30 / 100,
				-1);
    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(help_tv));
    set_help_text();

    label_aviso = glade_xml_get_widget(app, "label_aviso");
    
    FILE *exist;
    exist = fopen("/tmp/dhcp_ok","r");
    
    if (exist)
	    gtk_label_set_text (GTK_LABEL(label_aviso), "Su red ya ha sido configurada satisfactoriamente");
    else
	    gtk_label_set_text (GTK_LABEL(label_aviso), "!No se pudo configurar la red de forma automática!");
    
    /* Signals */
    g_signal_connect(G_OBJECT(GTK_EDITABLE(name_entry)), "changed",
		     G_CALLBACK(name_entry_changed), NULL);
    g_signal_connect(G_OBJECT(GTK_EDITABLE(name_entry)), "insert_text",
		     G_CALLBACK(names_entry_insert), NULL);
    g_signal_connect(G_OBJECT(GTK_EDITABLE(passwd_entry)), "changed",
		     G_CALLBACK(passwd_entry_changed), NULL);
    g_signal_connect(G_OBJECT(GTK_EDITABLE(passwd2_entry)), "changed",
		     G_CALLBACK(passwd2_entry_changed), NULL);
    g_signal_connect(G_OBJECT(GTK_EDITABLE(cname_entry)), "changed",
		     G_CALLBACK(cname_entry_changed), NULL);
    g_signal_connect(G_OBJECT(GTK_EDITABLE(cname_entry)), "insert_text",
		     G_CALLBACK(names_entry_insert), NULL);
    g_signal_connect(G_OBJECT(ok_button), "clicked",
		     G_CALLBACK(ok_button_cb), NULL);
    g_signal_connect(G_OBJECT(net_conf),"clicked",
		     G_CALLBACK(net_conf_clicked), NULL);

    gtk_window_fullscreen(GTK_WINDOW(win));
    gtk_widget_show_all(win);
    gtk_main();

    return 0;
}