Esempio n. 1
0
void about()
{
	GtkWidget *dialog;
	GtkWidget *contentlabel,*versionlabel,*authorlabel,*copyrightlabel;
	dialog = gnome_dialog_new(_("About the program"),_("OK"),NULL,NULL);
	contentlabel = gtk_label_new(_("Linux sniffer"));
	copyrightlabel = gtk_label_new(_("Copyright 2011-10-06"));
	authorlabel = gtk_label_new(_("付乔宾"));
	versionlabel = gtk_label_new(_("Version:1.0"));

	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),contentlabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),versionlabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),copyrightlabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),authorlabel,TRUE,TRUE,0);

	gtk_widget_show(contentlabel);
	gtk_widget_show(versionlabel);
	gtk_widget_show(copyrightlabel);
	gtk_widget_show(authorlabel);

	gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog);
	gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
	gtk_widget_show(dialog);
	gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app));
}
Esempio n. 2
0
void capture_filter()
{
	GtkWidget *dialog;
	GtkWidget *_hbox, *filter_label, *filter_entry, *filter_button;

	dialog = gnome_dialog_new(_("FilterString"),_("OK"),NULL,NULL);

	_hbox = gtk_hbox_new(FALSE,0);
	gtk_container_set_border_width(GTK_CONTAINER(_hbox), 5);
	filter_label = gtk_label_new("Filter String: ");
	filter_entry = gtk_entry_new();                                       
	filter_button = gtk_button_new_with_label("Save");                  

	gtk_box_pack_start(GTK_BOX(_hbox),filter_label,FALSE,FALSE,5);         
	gtk_box_pack_start(GTK_BOX(_hbox),filter_entry,TRUE,TRUE,6);
	gtk_box_pack_start(GTK_BOX(_hbox),filter_button,FALSE,FALSE,5);   
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),_hbox,TRUE,TRUE,0);
	
	g_signal_connect(GTK_OBJECT(filter_button),"clicked",GTK_SIGNAL_FUNC(get_filter_str),filter_entry);
	gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog);
	gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
	
	gtk_widget_show(filter_label);
	gtk_widget_show(filter_entry);
	gtk_widget_show(filter_button);
	gtk_widget_show(_hbox);
	gtk_widget_show(dialog);
	gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app));
}
Esempio n. 3
0
void ifselect(GtkWidget *widget,gpointer data)
{
	gint i = 0;
	GtkWidget *dialog;
	GtkWidget *_hbox;
	GtkWidget *label;
	GList *glist=NULL;
	GtkWidget *ifCombo;
	dialog = gnome_dialog_new(_("Choose a interface to capture"),_("OK"),NULL,NULL);
	
	_hbox = gtk_hbox_new(FALSE,0);
	label = gtk_label_new("Choose an interface: ");
	ifCombo = gtk_combo_new();

	for (i = 0; i < ifnum; i++)
	{
		glist = g_list_append(glist, ifitem[i].ifname);
	}
	gtk_combo_set_popdown_strings( GTK_COMBO(ifCombo), glist);
	
	gtk_box_pack_start(GTK_BOX(_hbox),label,FALSE,FALSE,5); 
	gtk_box_pack_start(GTK_BOX(_hbox),ifCombo,FALSE,FALSE,5); 
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),_hbox,TRUE,TRUE,0);

	gtk_signal_connect(GTK_OBJECT(GTK_COMBO(ifCombo)->entry), "activate",
			GTK_SIGNAL_FUNC (get_ifcard_str),NULL);
	gtk_widget_show(ifCombo);
	gtk_widget_show(label);
	gtk_widget_show(_hbox);

	gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog);
	gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
	gtk_widget_show(dialog);
	gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app));
}
Esempio n. 4
0
GtkWidget*
ghack_init_menu_window (void)
{
    GtkWidget *menuWin = NULL;
    GtkWidget *parent = ghack_get_main_window ();

    menuWin = gnome_dialog_new("GnomeHack", GNOME_STOCK_BUTTON_OK, 
		    GNOME_STOCK_BUTTON_CANCEL, NULL);
    
    gnome_dialog_set_default( GNOME_DIALOG(menuWin), 0);
    gtk_signal_connect(GTK_OBJECT(menuWin), "destroy",
		    GTK_SIGNAL_FUNC(ghack_menu_destroy),
		    NULL);

    gtk_signal_connect (GTK_OBJECT (menuWin), "delete_event",
			GTK_SIGNAL_FUNC (ghack_menu_hide),
			NULL);
          
    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_clear",
		    GTK_SIGNAL_FUNC(ghack_menu_window_clear),
		    NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_display",
                       GTK_SIGNAL_FUNC(ghack_menu_window_display),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_start_menu",
                       GTK_SIGNAL_FUNC(ghack_menu_window_start_menu),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_add_menu",
                       GTK_SIGNAL_FUNC(ghack_menu_window_add_menu),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_end_menu",
                       GTK_SIGNAL_FUNC(ghack_menu_window_end_menu),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_select_menu",
                       GTK_SIGNAL_FUNC(ghack_menu_window_select_menu),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_putstr",
                       GTK_SIGNAL_FUNC(ghack_menu_window_put_string),
                       NULL);

    gtk_signal_connect(GTK_OBJECT(menuWin), "key_press_event",
                       GTK_SIGNAL_FUNC(ghack_menu_window_key),
                       NULL);

    /* Center the dialog over parent */
    g_assert (parent != NULL);
    g_assert (menuWin != NULL);
    g_assert (GTK_IS_WINDOW (parent));
    g_assert (GNOME_IS_DIALOG (menuWin));
    gnome_dialog_set_parent (GNOME_DIALOG (menuWin), GTK_WINDOW (parent));
    
    return menuWin;
}
Esempio n. 5
0
static void
game_preferences_callback (GtkWidget *widget, void *data)
{
	GtkWidget *menu, *omenu, *l, *hb, *cb, *f, *fv;
	GtkWidget *button;

	if (pref_dialog)
		return;
	
	pref_dialog = gnome_dialog_new (_("Preferences"),
			GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL,
			NULL);
	gnome_dialog_set_parent (GNOME_DIALOG (pref_dialog), GTK_WINDOW (app));
	gtk_signal_connect (GTK_OBJECT(pref_dialog), "delete_event",
			    GTK_SIGNAL_FUNC (cancel), NULL);

	omenu = gtk_option_menu_new ();
	menu = gtk_menu_new ();
	fill_menu (menu);
	gtk_widget_show (omenu);
	gtk_option_menu_set_menu (GTK_OPTION_MENU(omenu), menu);

	f = gtk_frame_new (_ ("Scenario"));
	gtk_container_border_width (GTK_CONTAINER (f), 5);

	hb = gtk_hbox_new (FALSE, FALSE);
	gtk_widget_show (hb);
	
	l = gtk_label_new (_("Select scenario:"));
	gtk_widget_show (l);
	    
	gtk_box_pack_start_defaults (GTK_BOX(hb), l);
	gtk_box_pack_start_defaults (GTK_BOX(hb), omenu);

	cb = gtk_check_button_new_with_label ( _("Make it the default scenario") );
	gtk_signal_connect (GTK_OBJECT(cb), "clicked", (GtkSignalFunc)set_selection_def, NULL);
	gtk_widget_show (cb);

	fv = gtk_vbox_new (0, 5);
	gtk_container_border_width (GTK_CONTAINER (fv), 5);
	gtk_widget_show (fv);
	
	gtk_box_pack_start_defaults (GTK_BOX(fv), hb);
	gtk_box_pack_start_defaults (GTK_BOX(fv), cb);
	gtk_box_pack_start_defaults (GTK_BOX(GNOME_DIALOG(pref_dialog)->vbox), f);
	gtk_container_add (GTK_CONTAINER (f), fv);
	
	gtk_widget_show (f);
	
	gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 0,
			GTK_SIGNAL_FUNC (load_scenario_callback), NULL);
	gnome_dialog_button_connect (GNOME_DIALOG (pref_dialog), 1,
			GTK_SIGNAL_FUNC (cancel), (gpointer)1);

        gtk_widget_show (pref_dialog);
}
Esempio n. 6
0
static gboolean
gui_ask_password (Account *account) {
  GtkWidget *table;
  GtkWidget *label;
  GtkWidget *vbox;
  char *buf;
 
  password_go = FALSE;
  password_gbool = TRUE;
  password_window = gnome_dialog_new (_("Incorrect Password"),
      			GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
  vbox = GNOME_DIALOG (password_window)->vbox;
  buf = g_strdup_printf (_("The password of the account %s is wrong"), account->acc_name);
  label = gtk_label_new (buf);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);
  c2_free (buf);
  table = gtk_table_new (2, 2, FALSE);
  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
  gtk_widget_show (table);
  label = gtk_label_new (_("Username:"******"Password:"******"Y");
  gnome_dialog_button_connect (GNOME_DIALOG (password_window), 1, GTK_SIGNAL_FUNC (password_cb), (gpointer) "N");
  
  gdk_threads_leave ();
  while (!password_go) usleep (500);
  if (!password_gbool) return FALSE;
  buf = gtk_entry_get_text (GTK_ENTRY (password_entry));
  gdk_threads_enter ();
  if (!buf) return FALSE;
  c2_free (account->protocol.pop.pass);
  account->protocol.pop.pass = g_strdup (buf);
  gtk_widget_destroy (password_window);
  return TRUE;
}
Esempio n. 7
0
GtkWidget* create_Offline (void)
{
        GtkWidget *Offline;
        GtkWidget *dialog_vbox4;
        GtkWidget *dialog_action_area4;
        GtkWidget *butOfflineDelete;
        GtkWidget *butOfflineClose;

        Offline = gnome_dialog_new (_("gchat - Offline Messages"), NULL);
        gtk_widget_set_usize (Offline, 500, 250);
        gtk_window_set_default_size (GTK_WINDOW (Offline), 350, 200);
        gtk_window_set_resizable (GTK_WINDOW (Offline), FALSE);

        dialog_vbox4 = GNOME_DIALOG (Offline)->vbox;
        gtk_widget_show (dialog_vbox4);

        scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
        gtk_widget_show (scrolledwindow4);
        gtk_box_pack_start (GTK_BOX (dialog_vbox4), scrolledwindow4, TRUE, TRUE, 0);

        dialog_action_area4 = GNOME_DIALOG (Offline)->action_area;
        gtk_widget_show (dialog_action_area4);
        gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_EDGE);

        gnome_dialog_append_button (GNOME_DIALOG (Offline), "gtk-delete");
        butOfflineDelete = GTK_WIDGET (g_list_last (GNOME_DIALOG (Offline)->buttons)->data);
        gtk_widget_show (butOfflineDelete);
        gtk_widget_set_sensitive (butOfflineDelete, FALSE);
        GTK_WIDGET_SET_FLAGS (butOfflineDelete, GTK_CAN_DEFAULT);

        gnome_dialog_append_button (GNOME_DIALOG (Offline), "gtk-close");
        butOfflineClose = GTK_WIDGET (g_list_last (GNOME_DIALOG (Offline)->buttons)->data);
        gtk_widget_show (butOfflineClose);
        GTK_WIDGET_SET_FLAGS (butOfflineClose, GTK_CAN_DEFAULT);

        gtk_signal_connect (GTK_OBJECT (butOfflineDelete), "clicked",
                            G_CALLBACK (on_butOfflineDelete_clicked),
                            NULL);
        gtk_signal_connect (GTK_OBJECT (butOfflineClose), "clicked",
                            G_CALLBACK (on_butOfflineClose_clicked),
                            NULL);

        /* Store pointers to all widgets, for use by lookup_widget(). */
        GLADE_HOOKUP_OBJECT_NO_REF (Offline, Offline, "Offline");
        GLADE_HOOKUP_OBJECT_NO_REF (Offline, dialog_vbox4, "dialog_vbox4");
        GLADE_HOOKUP_OBJECT (Offline, scrolledwindow4, "scrolledwindow4");
        GLADE_HOOKUP_OBJECT_NO_REF (Offline, dialog_action_area4, "dialog_action_area4");
        GLADE_HOOKUP_OBJECT (Offline, butOfflineDelete, "butOfflineDelete");
        GLADE_HOOKUP_OBJECT (Offline, butOfflineClose, "butOfflineClose");

        return Offline;
}
Esempio n. 8
0
gint
main ( gint argc, gchar* argv[] )
{
	GtkWidget * dialog;
	GtkWidget * T;
	ColorGroup *cg;

	gnome_program_init ("tester", "1.0",
			    LIBGNOMEUI_MODULE,
			    argc, argv, NULL);

	dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK,
				   GNOME_STOCK_BUTTON_CANCEL, NULL);

	cg = color_group_fetch ("fore_color_group", dialog);
	T = color_palette_new ("Color Palette", NULL, cg);

	gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
			   T, TRUE, TRUE, 5);
	gtk_widget_show_all (T);

	cg = color_group_fetch ("fore_color_group", dialog);
	T = color_combo_new (
		gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm),
		_("Automatic"), &e_black, cg);
	gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
			   T, TRUE, TRUE, 5);
	gtk_widget_show_all (T);

	cg = color_group_fetch ("back_color_group", dialog);
	T = color_combo_new (
		gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm),
		_("Automatic"), &e_black, cg);
	gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
			   T, TRUE, TRUE, 5);
	gtk_widget_show_all (T);

	gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) );
	return 0;
}
Esempio n. 9
0
GtkWidget *
plugin_fortune_configure (C2DynamicModule *module) {
  GtkWidget *hbox;
  GtkWidget *label;

  window = gnome_dialog_new ("Configuration", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
  
  hbox = gtk_hbox_new (FALSE, 3);
  gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), hbox, FALSE, TRUE, 0);
  gtk_widget_show (hbox);
  
  label = gtk_label_new ("Command:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
  gtk_widget_show (entry);
  gtk_entry_set_text (GTK_ENTRY (entry), cmnd);

  label = gtk_label_new ("You can use the commands just like in the terminal.\n"
  			 "\n"
			 "i.e. signature; cat $HOME/.signature");
  gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (window)->vbox), label, TRUE, TRUE, 0);
  gtk_widget_show (label);
  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);

  gnome_dialog_button_connect (GNOME_DIALOG (window), 0,
  				GTK_SIGNAL_FUNC (on_plugin_fortune_configure_ok_btn_clicked), NULL);

  gnome_dialog_button_connect (GNOME_DIALOG (window), 1,
  				GTK_SIGNAL_FUNC (on_plugin_fortune_configure_cancel_btn_clicked), NULL);

  gtk_widget_show (window);
  
  return window;
}
Esempio n. 10
0
void display_statistics()
{
	gchar display[50];

	GtkWidget *dialog;
	GtkWidget *totlabel, *iplabel, *tcplabel, *udplabel, *arplabel, *icmplabel, *igmplabel;
	dialog = gnome_dialog_new(_("Statistics of the packets"),_("OK"),NULL,NULL);

	pthread_mutex_lock(&packet_stat_mtx);

	memset(display,0,sizeof(display));
	sprintf(display,"Total packets: %d",tot_packet);
	totlabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"IP packets: %d",ip_packet);
	iplabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"TCP packets: %d",tcp_packet);
	tcplabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"UDP packets: %d",udp_packet);
	udplabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"ARP packets: %d",arp_packet);
	arplabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"ICMP packets: %d",icmp_packet);
	icmplabel = gtk_label_new(display);

	memset(display,0,sizeof(display));
	sprintf(display,"IGMP packets: %d",igmp_packet);
	igmplabel = gtk_label_new(display);

	pthread_mutex_unlock(&packet_stat_mtx);

	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),totlabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),iplabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),tcplabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),udplabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),arplabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),icmplabel,TRUE,TRUE,0);
	gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),igmplabel,TRUE,TRUE,0);

	gtk_widget_show(totlabel);
	gtk_widget_show(iplabel);
	gtk_widget_show(tcplabel);
	gtk_widget_show(udplabel);
	gtk_widget_show(arplabel);
	gtk_widget_show(icmplabel);
	gtk_widget_show(igmplabel);

	gtk_signal_connect(GTK_OBJECT(dialog),"clicked",GTK_SIGNAL_FUNC(dialog_ok),&dialog);
	gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
	gtk_widget_show(dialog);
	gnome_dialog_set_parent(GNOME_DIALOG(dialog),GTK_WINDOW(app));
}
Esempio n. 11
0
void
ghack_settings_dialog()
{
    int i;
    static GtkWidget* dialog;
    static GtkWidget* swin;
    static GtkWidget* frame1;

    dialog = gnome_dialog_new (_("GnomeHack Settings"),
			    GNOME_STOCK_BUTTON_OK,
			    GNOME_STOCK_BUTTON_CANCEL,
			    NULL);
    gnome_dialog_close_hides (GNOME_DIALOG (dialog), FALSE);
    gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
		      GTK_SIGNAL_FUNC (opt_sel_key_hit), tilesets );

    frame1 = gtk_frame_new (_("Choose one of the following tilesets:"));
    gtk_object_set_data (GTK_OBJECT (dialog), "frame1", frame1);
    gtk_widget_show (frame1);
    gtk_container_border_width (GTK_CONTAINER (frame1), 3);

    swin = gtk_scrolled_window_new (NULL, NULL);
    clist = gtk_clist_new (2);
    gtk_clist_column_titles_hide (GTK_CLIST (clist));
    gtk_widget_set_usize (GTK_WIDGET (clist), 100, 180);
    gtk_container_add (GTK_CONTAINER (swin), clist);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
	    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    gtk_signal_connect (GTK_OBJECT (clist), "select_row",
			GTK_SIGNAL_FUNC (opt_sel_row_selected), NULL );

    gtk_container_add (GTK_CONTAINER (frame1), swin);
    gtk_box_pack_start_defaults (GTK_BOX (GNOME_DIALOG (dialog)->vbox), frame1);

    /* Add the tilesets into the list here... */
    for (i=0; i < no_tilesets; i++) {
	    gchar accelBuf[BUFSZ];
	    const char *text[3]={accelBuf, tilesets[i].name,NULL};
	    if ((tilesets[i].flags & ~TILESET_TRANSPARENT) != 0)
		continue;		/* Unsupported flag set */
	    sprintf( accelBuf, "%c ", tolower(tilesets[i].name[0]));
	    gtk_clist_insert (GTK_CLIST (clist), i, (char**)text);
    }


    gtk_clist_columns_autosize (GTK_CLIST (clist));
    gtk_widget_show_all (swin);

    /* Center the dialog over over parent */
    gnome_dialog_set_default( GNOME_DIALOG(dialog), 0);
    gtk_window_set_modal( GTK_WINDOW(dialog), TRUE);
    gnome_dialog_set_parent (GNOME_DIALOG (dialog),
	    GTK_WINDOW (ghack_get_main_window ()) );

    /* Run the dialog -- returning whichever button was pressed */
    i = gnome_dialog_run (GNOME_DIALOG (dialog));
    gnome_dialog_close (GNOME_DIALOG (dialog));

    /* They hit Quit or error */
    if (i != 0 ) {
	return;
    }
    if (gn_tileset < no_tilesets) {
	    if (tilesets[gn_tileset].file[0] != '/') {
		char *path;
		path = (char *)alloc(strlen(TILESETDIR) +
		  strlen(tilesets[gn_tileset].file) + 2);
		sprintf(path, TILESETDIR "/%s", tilesets[gn_tileset].file);
		ghack_free_glyphs();
		if (ghack_init_glyphs(path))
			  g_error ("ERROR:  Could not initialize glyphs.\n");
		free(path);
	    }
	    else {
		ghack_free_glyphs();
		if (ghack_init_glyphs(tilesets[gn_tileset].file))
			  g_error ("ERROR:  Could not initialize glyphs.\n");
	    }
	    ghack_reinit_map_window();
    } else {
	    /* This shouldn't happen */
	    g_warning("This shouldn't happen\n");
    }
}
Esempio n. 12
0
/*
 * Creates a new GtkWidget of class GnomeDialog, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
static GtkWidget*
gb_gnome_dialog_new (GbWidgetNewData *data)
{
  GtkWidget *new_widget, *placeholder;
  GList *elem;

  if (data->action == GB_CREATING)
    {
      /* When creating a new dialog, we add a few standard buttons, which
	 the user can change/delete easily. */
      new_widget = gnome_dialog_new (NULL, 
				     GTK_STOCK_CANCEL, 
				     GTK_STOCK_OK,
				     NULL);

      /* Now turn the buttons into GbWidgets so the user can edit them. */
      elem = GNOME_DIALOG (new_widget)->buttons;
      gb_widget_create_from (GTK_WIDGET (elem->data), "button");
      gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
			   GTK_STOCK_CANCEL);

      elem = elem->next;
      gb_widget_create_from (GTK_WIDGET (elem->data), "button");
      gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
			   GTK_STOCK_OK);

      /* We need to size the placeholders or the dialog is very small. */
      placeholder = editor_new_placeholder ();
      gtk_widget_set_usize (placeholder, 300, 200);
      gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (new_widget)->vbox),
			  placeholder, TRUE, TRUE, 0);
    }
  else
    {
      /* When loading we create the bare dialog with no buttons. */
      new_widget = gnome_dialog_new (NULL, NULL);
    }

  gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox,
			 data->action == GB_CREATING ? "dialog-vbox" : NULL);
  gb_widget_set_child_name (GNOME_DIALOG (new_widget)->vbox, GladeChildDialogVBox);

  gb_widget_create_from (GNOME_DIALOG (new_widget)->action_area,
			 data->action == GB_CREATING ? "dialog-action_area"
						     : NULL);
  gb_widget_set_child_name (GNOME_DIALOG (new_widget)->action_area,
			    GladeChildDialogActionArea);

  /* We connect a close signal handler which always returns TRUE so that
     the built-in close functionality is skipped. */
  gtk_signal_connect (GTK_OBJECT (new_widget), "close",
		      GTK_SIGNAL_FUNC (gtk_true), NULL);

  /* Now we connect our normal delete_event handler. */
  gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
		      GTK_SIGNAL_FUNC (editor_close_window), NULL);

  gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
		       GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));

  return new_widget;
}
Esempio n. 13
0
int
ghack_menu_ext_cmd(void)
{
    int n;
    GtkWidget* dialog;
    GtkWidget* swin;
    GtkWidget* frame1;
    GtkWidget* clist;
    extMenu info;

    dialog = gnome_dialog_new("Extended Commands",
			      GNOME_STOCK_BUTTON_OK,
			      GNOME_STOCK_BUTTON_CANCEL,
			      NULL);
    gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
    gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
		       GTK_SIGNAL_FUNC(ghack_ext_key_hit), &info);

    frame1 = gtk_frame_new("Make your selection");
    gtk_object_set_data(GTK_OBJECT(dialog), "frame1", frame1);
    gtk_widget_show(frame1);
    gtk_container_border_width(GTK_CONTAINER(frame1), 3);

    swin = gtk_scrolled_window_new(NULL, NULL);
    clist = gtk_clist_new(2);
    gtk_object_set_data(GTK_OBJECT(dialog), "clist", clist);
    gtk_widget_set_usize(clist, 500, 400);
    gtk_container_add(GTK_CONTAINER(swin), clist);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
				   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    gtk_signal_connect(GTK_OBJECT(clist), "select_row",
		       GTK_SIGNAL_FUNC(ghack_menu_row_selected), NULL);

    gtk_container_add(GTK_CONTAINER(frame1), swin);
    gtk_box_pack_start_defaults(GTK_BOX(GNOME_DIALOG(dialog)->vbox), frame1);

    /* Add the extended commands into the list here... */
    for (n = 0; extcmdlist[n].ef_txt; ++n) {
	const char *text[3]={extcmdlist[n].ef_txt,extcmdlist[n].ef_desc,NULL};
	gtk_clist_insert(GTK_CLIST(clist), n, (char**) text);
    }

    /* fill in starting info fields */
    info.curItem = -1;
    info.numRows = n;
    info.charIdx = 0;
    info.lastTime = 0;

    gtk_clist_columns_autosize(GTK_CLIST(clist));
    gtk_widget_show_all(swin);

    /* Center the dialog over over parent */
    gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
    gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
    gnome_dialog_set_parent(GNOME_DIALOG(dialog),
			    GTK_WINDOW(ghack_get_main_window()));

    /* Run the dialog -- returning whichever button was pressed */
    n = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));

    /* Quit on button 2 or error */
    return (n != 0) ? -1 : info.curItem;
}
Esempio n. 14
0
static gboolean gui_message_big_new (const char *from, const char *subject, const char *date, const  char *account, const  char *kbytes) {
  GtkWidget *vbox, *hbox;
  GtkWidget *table;
  GtkWidget *label;
  GtkWidget *hsep;
  GtkStyle *style1;
  GtkStyle *style2;
  char *buf;
  GtkWidget *xpm;

  go = FALSE;
  gbool = TRUE;

  window = gnome_dialog_new (_("Confirm message downloading"),
      			GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
  gtk_window_set_modal (GTK_WINDOW (window), TRUE);
  gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (WMain->window));
  gnome_dialog_set_default (GNOME_DIALOG (window), 0);

  vbox = GNOME_DIALOG (window)->vbox;

  label = gtk_label_new (_("There's a message bigger than what you allowed to automatically download."));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

  table = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table);
  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);

  if (from && subject && date) {
    label = gtk_label_new (_("From:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (from);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    
    label = gtk_label_new (_("Date:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (date);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  } else {
    label = gtk_label_new (_("Since the server doesn't support advanced POP commands very little information about this message could be extracted."));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
  }
  
  label = gtk_label_new (_("Account:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
      (GtkAttachOptions) (GTK_FILL),
      (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  if (from && subject && date) {
    label = gtk_label_new (_("Subject:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (subject);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 4, 5,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  }
  
  label = gtk_label_new (_("Size:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  buf = g_strdup_printf ("%s (%d Kb)", kbytes, atoi (kbytes)/1024);
  label = gtk_label_new (buf);
  c2_free (buf);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

  label= gtk_label_new (account);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

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

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
  
  buf = gnome_unconditional_pixmap_file("gnome-question.png");
  if (buf) {
    xpm = gnome_pixmap_new_from_file(buf);
    c2_free(buf);
    gtk_widget_show (xpm);
    gtk_box_pack_start (GTK_BOX (hbox), xpm, FALSE, FALSE, 0);
  }
  
  label = gtk_label_new (_("Do you want to download it?"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);

  gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (cb), (gpointer) "Y");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 0, GDK_Y, 0);
  gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (cb), (gpointer) "N");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 1, GDK_N, 0);

  gtk_widget_show (window);

  gdk_threads_leave ();
  while (!go) usleep (500);
  gdk_threads_enter ();
  return gbool;
}
Esempio n. 15
0
int main_update_please(GtkWidget * update_button, gpointer data)
{
    extern GtkWidget *connection_label;
    GtkWidget *dialog_vbox1;
    GtkWidget *vbox1;
    GtkWidget *hseparator3;
    GtkWidget *table1;
    GtkWidget *label3;
    GtkWidget *label6;
    GtkWidget *hseparator1;
    GtkWidget *label2;
    GtkWidget *label1;
    GtkWidget *dialog_action_area1;

    uploaded_bytes = 0.0;

    if (selected_site == NULL) {
	gnome_error_dialog("You must select a site if you want to upload the changes!");
	return 0;
    }
    if (!selected_site->remote_is_different) {
	gfe_status("Remote and local sites are already synchronised.");
	return 1;
    }
   
    upload_total = selected_site->totalnew + selected_site->totalchanged;
    make_error_window();
    upload_window = gnome_dialog_new("Update Progress", NULL);
    gtk_widget_set_usize(upload_window, 480, -2);

    dialog_vbox1 = GNOME_DIALOG(upload_window)->vbox;
    gtk_widget_show(dialog_vbox1);

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

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

    table1 = gtk_table_new(4, 2, FALSE);
    gtk_widget_show(table1);
    gtk_box_pack_start(GTK_BOX(vbox1), table1, TRUE, TRUE, 0);
    gtk_table_set_row_spacings(GTK_TABLE(table1), 1);
    gtk_table_set_col_spacings(GTK_TABLE(table1), 2);

    status_label = gtk_label_new("Click Upload to begin.");
    gtk_widget_show(status_label);
    connection_label = status_label;
    gtk_table_attach(GTK_TABLE(table1), status_label, 1, 2, 0, 1,
		     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(status_label), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(status_label), 7.45058e-09, 0.5);

    op_label = gtk_label_new(" ");
    gtk_widget_show(op_label);
    gtk_table_attach(GTK_TABLE(table1), op_label, 0, 2, 1, 2,
		     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(op_label), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(op_label), 7.45058e-09, 0.5);

    file_label = gtk_label_new("");
    gtk_widget_show(file_label);
    gtk_table_attach(GTK_TABLE(table1), file_label, 0, 2, 2, 3,
		     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(file_label), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(file_label), 7.45058e-09, 0.5);

    label3 = gtk_label_new("Status: ");
    gtk_widget_show(label3);
    gtk_table_attach(GTK_TABLE(table1), label3, 0, 1, 0, 1,
		     (GtkAttachOptions) (GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(label3), 7.45058e-09, 0.5);

    label6 = gtk_label_new("To: ");
    gtk_widget_show(label6);
    gtk_table_attach(GTK_TABLE(table1), label6, 0, 1, 3, 4,
		     (GtkAttachOptions) (GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(label6), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(label6), 7.45058e-09, 0.5);

    dir_label = gtk_label_new(" ");
    gtk_widget_show(dir_label);
    gtk_table_attach(GTK_TABLE(table1), dir_label, 1, 2, 3, 4,
		     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
		     (GtkAttachOptions) (0), 0, 0);
    gtk_label_set_justify(GTK_LABEL(dir_label), GTK_JUSTIFY_LEFT);
    gtk_misc_set_alignment(GTK_MISC(dir_label), 7.45058e-09, 0.5);

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

    label2 = gtk_label_new("Current Progress");
    gtk_widget_show(label2);
    gtk_box_pack_start(GTK_BOX(vbox1), label2, TRUE, FALSE, 2);
    gtk_misc_set_alignment(GTK_MISC(label2), 0.5, 1);

    main_progressbar = gtk_progress_bar_new();
    gtk_widget_show(main_progressbar);
    gtk_box_pack_start(GTK_BOX(vbox1), main_progressbar, TRUE, FALSE, 0);
    gtk_progress_set_show_text(GTK_PROGRESS(main_progressbar), TRUE);

    label1 = gtk_label_new("Total Progress");
    gtk_widget_show(label1);
    gtk_box_pack_start(GTK_BOX(vbox1), label1, TRUE, FALSE, 2);
    gtk_misc_set_alignment(GTK_MISC(label1), 0.5, 1);

    job_progressbar = gtk_progress_bar_new();
    gtk_widget_show(job_progressbar);
    gtk_box_pack_start(GTK_BOX(vbox1), job_progressbar, TRUE, FALSE, 0);
    gtk_progress_set_show_text(GTK_PROGRESS(job_progressbar), TRUE);

    keep_going_button = gtk_check_button_new_with_label("Ignore any errors and always keep going.");
    gtk_widget_show(keep_going_button);
    gtk_box_pack_start(GTK_BOX(vbox1), keep_going_button, TRUE, TRUE, 0);

    dialog_action_area1 = GNOME_DIALOG(upload_window)->action_area;
    gtk_widget_show(dialog_action_area1);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);
    gtk_button_box_set_spacing(GTK_BUTTON_BOX(dialog_action_area1), 8);

    gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(upload_window),
				   "Upload", GNOME_STOCK_PIXMAP_CONVERT);
    begin_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data;
    gtk_widget_show(begin_button);
    GTK_WIDGET_SET_FLAGS(begin_button, GTK_CAN_DEFAULT);

    gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(upload_window),
			       "View Errors", GNOME_STOCK_PIXMAP_SEARCH);
    error_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data;
    gtk_signal_connect_object(GTK_OBJECT(error_button), "clicked",
			      GTK_SIGNAL_FUNC(gtk_widget_show),
			      GTK_OBJECT(error_log_window));
    gtk_widget_show(error_button);
    gtk_widget_set_sensitive(error_button, FALSE);
    GTK_WIDGET_SET_FLAGS(error_button, GTK_CAN_DEFAULT);

    gnome_dialog_append_button(GNOME_DIALOG(upload_window), GNOME_STOCK_BUTTON_CLOSE);
    close_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data;
    gtk_signal_connect(GTK_OBJECT(close_button), "clicked",
		       GTK_SIGNAL_FUNC(close_main_update_window), NULL);
/*    gtk_signal_connect_object(GTK_OBJECT(close_button), "clicked",
			      GTK_SIGNAL_FUNC(gnome_dialog_close),
			      (gpointer) upload_window);
*/  
    gtk_widget_show(close_button);
    GTK_WIDGET_SET_FLAGS(close_button, GTK_CAN_DEFAULT);

   if (strcmp((gchar *)data, "single") == 0) {
      gtk_signal_connect(GTK_OBJECT(begin_button), "clicked",
			 GTK_SIGNAL_FUNC(start_main_update),
			 "single");
   } else if (strcmp((gchar *)data, "all") == 0) {
      gtk_signal_connect(GTK_OBJECT(begin_button), "clicked",
			 GTK_SIGNAL_FUNC(start_main_update),
			 "all");
   } else {
      g_assert_not_reached();
   }
    gtk_widget_show(upload_window);
    return 2;
}
Esempio n. 16
0
int
ghack_player_sel_dialog(const char** choices,
			const gchar* title,
			const gchar* prompt)
{
    int i;
    static GtkWidget* dialog;
    static GtkWidget* swin;
    static GtkWidget* frame1;

    dialog = gnome_dialog_new(title,
			    GNOME_STOCK_BUTTON_OK,
			    _("Random"),
			    GNOME_STOCK_BUTTON_CANCEL,
			    NULL);
    gnome_dialog_close_hides (GNOME_DIALOG (dialog), FALSE);
    gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
                      GTK_SIGNAL_FUNC (player_sel_key_hit), choices );

    frame1 = gtk_frame_new(prompt);
    gtk_object_set_data (GTK_OBJECT (dialog), "frame1", frame1);
    gtk_widget_show (frame1);
    gtk_container_border_width (GTK_CONTAINER (frame1), 3);

    swin = gtk_scrolled_window_new (NULL, NULL);
    clist = gtk_clist_new (2);
    gtk_clist_column_titles_hide (GTK_CLIST (clist));
    gtk_widget_set_usize (GTK_WIDGET (clist), 100, 180);
    gtk_container_add (GTK_CONTAINER (swin), clist);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
	    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    gtk_signal_connect (GTK_OBJECT (clist), "select_row",
			GTK_SIGNAL_FUNC (player_sel_row_selected), NULL );

    gtk_container_add (GTK_CONTAINER (frame1), swin);
    gtk_box_pack_start_defaults (GTK_BOX (GNOME_DIALOG (dialog)->vbox), frame1);

    /* Add the roles into the list here... */
    for (i=0; choices[i]; i++) {
	    gchar accelBuf[BUFSZ];
	    const char *text[3]={accelBuf, choices[i],NULL};
	    sprintf( accelBuf, "%c ", tolower(choices[i][0]));
	    gtk_clist_insert (GTK_CLIST (clist), i, (char**)text);
    }

    gtk_clist_columns_autosize (GTK_CLIST (clist));
    gtk_widget_show_all (swin);

    /* Center the dialog over over parent */
    gnome_dialog_set_default( GNOME_DIALOG(dialog), 0);
    gtk_window_set_modal( GTK_WINDOW(dialog), TRUE);
    gnome_dialog_set_parent (GNOME_DIALOG (dialog),
	    GTK_WINDOW (ghack_get_main_window ()) );

    /* Run the dialog -- returning whichever button was pressed */
    i = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));

    /* Quit on button 2 or error */
    if (i < 0  || i > 1) {
	return(ROLE_NONE);
    }
    /* Random is button 1*/
    if (i == 1 ) {
	return(ROLE_RANDOM);
    }
    return ( role_number);
}
void
gnome_sort_cmd (GtkWidget *widget, WPanel *panel)
/* Helps you determine the order in which the files exist. */
{
	GtkWidget *sort_box;
	GtkWidget *hbox;
        GtkWidget *omenu;
        GtkWidget *menu;
        GtkWidget *menu_item;
	GtkWidget *cbox;

	sort_box = gnome_dialog_new ("Sort By", GNOME_STOCK_BUTTON_OK, 
				     GNOME_STOCK_BUTTON_CANCEL, NULL);
	hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox), hbox, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new ("Sort files by "), FALSE, FALSE, 0);

	omenu = gtk_option_menu_new ();
        gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
        menu = gtk_menu_new ();
        menu_item = gtk_menu_item_new_with_label ( _("Name"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_NAME);
        menu_item = gtk_menu_item_new_with_label ( _("File Type"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_EXTENSION);
	menu_item = gtk_menu_item_new_with_label ( _("Size"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_SIZE);
        menu_item = gtk_menu_item_new_with_label ( _("Time Last Accessed"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_ACCESS);
        menu_item = gtk_menu_item_new_with_label ( _("Time Last Modified"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_MODIFY);
        menu_item = gtk_menu_item_new_with_label ( _("Time Last Changed"));
        gtk_menu_append (GTK_MENU (menu), menu_item);
        gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
                            GTK_SIGNAL_FUNC (option_menu_sort_callback), (gpointer) SORT_CHANGE);
	gtk_widget_show_all (menu);
        gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);

	
	cbox = gtk_check_button_new_with_label (N_("Reverse the order."));
	gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
			    cbox, FALSE, FALSE, 0);
	cbox = gtk_check_button_new_with_label (N_("Ignore case sensitivity."));
	gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
			    cbox, FALSE, FALSE, 0);
	/* off to the races */
	gtk_widget_show_all (GNOME_DIALOG (sort_box)->vbox);
	gnome_dialog_run (GNOME_DIALOG (sort_box));

	/* Reverse order */
	/* case sensitive */
}
Esempio n. 18
0
static void
GDict_dlg_create (const char * search)
{
  GtkWidget * vbox;
  GtkWidget * hbox;
  GtkWidget * button;
  GtkWidget * scrolled;
  GtkWidget * close;
  GtkWidget * gtk_entry;
  
  // create the toplevel dialog
  gdict_dlg = gnome_dialog_new ("AbiWord Dictionary", 
				GNOME_STOCK_BUTTON_CLOSE, NULL);
  gtk_window_set_modal (GTK_WINDOW(gdict_dlg), false);
  gtk_widget_set_usize (gdict_dlg, 450, 300);

  // center the dialog and connect focus
  XAP_App * pApp = XAP_App::getApp ();
  XAP_UnixFrame * pFrame = static_cast<XAP_UnixFrame*>(pApp->getLastFocussedFrame ());
  GtkWidget * parent = pFrame->getTopLevelWindow();
  centerDialog(parent, gdict_dlg);

  close = GTK_WIDGET (g_list_last (GNOME_DIALOG (gdict_dlg)->buttons)->data);  
  vbox = GNOME_DIALOG(gdict_dlg)->vbox;
  
  hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);	
  gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  
  button = gtk_button_new_with_label ("Look Up");
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
  
  gdict_entry = gnome_entry_new(NULL);
  gtk_entry = gnome_entry_gtk_entry(GNOME_ENTRY(gdict_entry));
  gtk_box_pack_start (GTK_BOX (hbox), gdict_entry, TRUE, TRUE, 0);

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_set_border_width (GTK_CONTAINER (scrolled), GNOME_PAD_SMALL); 
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
				  GTK_POLICY_AUTOMATIC,
				  GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
  
  gdict_defbox = gdict_defbox_new ();
  gtk_widget_show (gdict_defbox);
  gtk_container_add (GTK_CONTAINER (scrolled), gdict_defbox);
  
  g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (lookup_button_cb), gdict_defbox);

  g_signal_connect (G_OBJECT (gtk_entry), "activate",
		      G_CALLBACK (entry_activate_cb), gdict_defbox);
#if 0
  g_signal_connect (G_OBJECT (gtk_entry), "changed",
		      G_CALLBACK (entry_activate_cb), gdict_defbox);
#endif  

  g_signal_connect (G_OBJECT (gdict_dlg),
		      "close",
		      G_CALLBACK(close_cb),
		      (gpointer)0);
  
  g_signal_connect (G_OBJECT (close),
		      "clicked",
		      G_CALLBACK(close_cb),
		      (gpointer)0);

  g_signal_connect_after(G_OBJECT(gdict_dlg),
			   "destroy",
			   NULL,
			   NULL);

  gtk_widget_show_all (gdict_dlg);
}
Esempio n. 19
0
/* Display the file named str.  Complain about missing files
                   iff complain is TRUE.
*/
void gnome_display_file(const char *filename,BOOLEAN_P must_exist)
{
	/* Strange -- for some reason it makes us create a new text window
	 * instead of reusing any existing ones -- perhaps we can work out
	 * some way to reuse stuff -- but for now just make and destroy new
	 * ones each time */
        
	dlb *f;
       
        f = dlb_fopen(filename, "r");
        if (!f) {
	  if (must_exist) {
	    GtkWidget *box;
            char message[90];
            sprintf(message, "Warning! Could not find file: %s\n",filename);

	    box = gnome_message_box_new (_(message),
		    GNOME_MESSAGE_BOX_ERROR,
		    GNOME_STOCK_BUTTON_OK,
		    NULL);
	    gnome_dialog_set_default( GNOME_DIALOG(box), 0);
	    gnome_dialog_set_parent (GNOME_DIALOG (box), 
		    GTK_WINDOW (ghack_get_main_window ()) );
	    gtk_window_set_modal( GTK_WINDOW(box), TRUE);
	    gtk_widget_show (box);
	  }
        }
	else {
    	  GtkWidget *txtwin, *gless, *frametxt;
#define LLEN 128
	  char line[LLEN], *textlines;
	  int num_lines, charcount;

	  txtwin = gnome_dialog_new("Text Window", GNOME_STOCK_BUTTON_OK,
				    NULL);
          gtk_widget_set_usize(GTK_WIDGET(txtwin), 500, 400);
          gtk_window_set_policy(GTK_WINDOW(txtwin), TRUE, TRUE, FALSE);
          gtk_window_set_title(GTK_WINDOW(txtwin), "Text Window");
	  gnome_dialog_set_default( GNOME_DIALOG(txtwin), 0);
	  gtk_window_set_modal( GTK_WINDOW(txtwin), TRUE);
	  frametxt = gtk_frame_new ("");
	  gtk_widget_show (frametxt);

	  /*
	   * Count the number of lines and characters in the file.
	   */
	  num_lines = 0;
	  charcount = 1;
	  while (dlb_fgets(line, LLEN, f)) {
	    num_lines++;
	    charcount += strlen(line);
	  }
	  (void) dlb_fclose(f);
	  
	  /* Ignore empty files */
	  if (num_lines == 0) return;

	  /*
	   * Re-open the file and read the data into a buffer.  
	   */
	  textlines = (char *) alloc((unsigned int) charcount);
	  textlines[0] = '\0';
	  f = dlb_fopen( filename, RDTMODE);

	  while (dlb_fgets(line, LLEN, f)) {
	    (void) strcat(textlines, line);
	  }
	  (void) dlb_fclose(f);

	  gless = gnome_less_new ();
	  gnome_less_show_string (GNOME_LESS (gless), textlines);
	  gtk_container_add (GTK_CONTAINER (frametxt), gless);
          gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (txtwin)->vbox), frametxt,
                             TRUE, TRUE, 0);
	  gtk_widget_show_all( txtwin);
	  gtk_window_set_modal( GTK_WINDOW(txtwin), TRUE);
	  gnome_dialog_set_parent (GNOME_DIALOG (txtwin), 
		  GTK_WINDOW (ghack_get_main_window ()) );
	  gnome_dialog_run_and_close (GNOME_DIALOG (txtwin));
	  free(textlines);
        }
}
Esempio n. 20
0
GtkWidget* create_AddContacts (void)
{
        GtkWidget *AddContacts;
        GtkWidget *dialog_vbox3;
        GtkWidget *vbox6;
        GtkWidget *label15;
        GtkWidget *hbox7;
        GtkWidget *image11;
        GtkWidget *label14;
        GtkWidget *image12;
        GtkWidget *entNewContactsid;
        GtkWidget *image13;
        GtkWidget *label16;
        GtkWidget *dialog_action_area3;
        GtkWidget *butAddContactsCancel;
        GtkWidget *butAddContactsOk;

        AddContacts = gnome_dialog_new (_("gchat - Add contacts"), NULL);
        gtk_widget_set_usize (AddContacts, 300, 120);
        gtk_window_set_default_size (GTK_WINDOW (AddContacts), 300, 120);
        gtk_window_set_resizable (GTK_WINDOW (AddContacts), FALSE);

        dialog_vbox3 = GNOME_DIALOG (AddContacts)->vbox;
        gtk_widget_show (dialog_vbox3);

        vbox6 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox6);
        gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox6, TRUE, TRUE, 0);

        label15 = gtk_label_new ("");
        gtk_widget_show (label15);
        gtk_box_pack_start (GTK_BOX (vbox6), label15, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_LEFT);

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

        image11 = create_pixmap (AddContacts, NULL);
        gtk_widget_show (image11);
        gtk_box_pack_start (GTK_BOX (hbox7), image11, TRUE, TRUE, 0);

        label14 = gtk_label_new (_("Contact's id"));
        gtk_widget_show (label14);
        gtk_box_pack_start (GTK_BOX (hbox7), label14, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_LEFT);

        image12 = create_pixmap (AddContacts, NULL);
        gtk_widget_show (image12);
        gtk_box_pack_start (GTK_BOX (hbox7), image12, TRUE, TRUE, 0);

        entNewContactsid = gtk_entry_new ();
        gtk_widget_show (entNewContactsid);
        gtk_box_pack_start (GTK_BOX (hbox7), entNewContactsid, TRUE, TRUE, 0);

        image13 = create_pixmap (AddContacts, NULL);
        gtk_widget_show (image13);
        gtk_box_pack_start (GTK_BOX (hbox7), image13, TRUE, TRUE, 0);

        label16 = gtk_label_new ("");
        gtk_widget_show (label16);
        gtk_box_pack_start (GTK_BOX (vbox6), label16, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label16), GTK_JUSTIFY_LEFT);

        dialog_action_area3 = GNOME_DIALOG (AddContacts)->action_area;
        gtk_widget_show (dialog_action_area3);
        gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_SPREAD);

        gnome_dialog_append_button (GNOME_DIALOG (AddContacts), "gtk-cancel");
        butAddContactsCancel = GTK_WIDGET (g_list_last (GNOME_DIALOG (AddContacts)->buttons)->data);
        gtk_widget_show (butAddContactsCancel);
        GTK_WIDGET_SET_FLAGS (butAddContactsCancel, GTK_CAN_DEFAULT);

        gnome_dialog_append_button (GNOME_DIALOG (AddContacts), "gtk-ok");
        butAddContactsOk = GTK_WIDGET (g_list_last (GNOME_DIALOG (AddContacts)->buttons)->data);
        gtk_widget_show (butAddContactsOk);
        GTK_WIDGET_SET_FLAGS (butAddContactsOk, GTK_CAN_DEFAULT);

        gtk_signal_connect (GTK_OBJECT (butAddContactsCancel), "clicked",
                            G_CALLBACK (on_butAddContactsCancel_clicked),
                            NULL);
        gtk_signal_connect (GTK_OBJECT (butAddContactsOk), "clicked",
                            G_CALLBACK (on_butAddContactsOk_clicked),
                            NULL);

        /* Store pointers to all widgets, for use by lookup_widget(). */
        GLADE_HOOKUP_OBJECT_NO_REF (AddContacts, AddContacts, "AddContacts");
        GLADE_HOOKUP_OBJECT_NO_REF (AddContacts, dialog_vbox3, "dialog_vbox3");
        GLADE_HOOKUP_OBJECT (AddContacts, vbox6, "vbox6");
        GLADE_HOOKUP_OBJECT (AddContacts, label15, "label15");
        GLADE_HOOKUP_OBJECT (AddContacts, hbox7, "hbox7");
        GLADE_HOOKUP_OBJECT (AddContacts, image11, "image11");
        GLADE_HOOKUP_OBJECT (AddContacts, label14, "label14");
        GLADE_HOOKUP_OBJECT (AddContacts, image12, "image12");
        GLADE_HOOKUP_OBJECT (AddContacts, entNewContactsid, "entNewContactsid");
        GLADE_HOOKUP_OBJECT (AddContacts, image13, "image13");
        GLADE_HOOKUP_OBJECT (AddContacts, label16, "label16");
        GLADE_HOOKUP_OBJECT_NO_REF (AddContacts, dialog_action_area3, "dialog_action_area3");
        GLADE_HOOKUP_OBJECT (AddContacts, butAddContactsCancel, "butAddContactsCancel");
        GLADE_HOOKUP_OBJECT (AddContacts, butAddContactsOk, "butAddContactsOk");

        return AddContacts;
}