Exemple #1
0
GtkWidget * gw_status_bar_create ( GtkWindow *w)
{
    GtkWidget *gw_status_bar_box;
    GtkWidget *hbox;
    GtkWidget *status_bar1;
    GtkWidget *status_bar2;


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

    gw_status_bar_box = gtk_viewport_new ( NULL, NULL);
    gtk_viewport_set_shadow_type ( GTK_VIEWPORT ( gw_status_bar_box), GTK_SHADOW_NONE);

    hbox = gtk_hbox_new ( FALSE, 0);
    gtk_container_add ( GTK_CONTAINER ( gw_status_bar_box), hbox);

    /* First status bar */
    status_bar1 = gtk_statusbar_new ( );
    gtk_widget_ref ( status_bar1);
    gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_STATUS_BAR_FIRST_STATUS, status_bar1, (GtkDestroyNotify) gtk_widget_unref);
    gtk_box_pack_start ( GTK_BOX ( hbox), status_bar1, FALSE, FALSE, 0);
    gtk_widget_set_usize ( status_bar1, 500, -2);

    /* Second status bar */
    status_bar2 = gtk_statusbar_new ( );
    gtk_widget_ref ( status_bar2);
    gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_STATUS_BAR_SECOND_STATUS, status_bar2, (GtkDestroyNotify) gtk_widget_unref);
    gtk_box_pack_start ( GTK_BOX ( hbox), status_bar2, TRUE, TRUE, 0);

    return gw_status_bar_box;
}
Exemple #2
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_gnome_icon_entry_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *title, *history_id;
  gint max_saved;

  title = gb_widget_input_string (data, Title);
  if (data->apply)
    {
      gtk_object_set_data_full (GTK_OBJECT (widget), Title, g_strdup (title),
				title ? g_free : NULL);
      gnome_icon_entry_set_browse_dialog_title (GNOME_ICON_ENTRY (widget),
						title && title[0] ? title : "");
    }

  history_id = gb_widget_input_string (data, HistoryID);
  if (data->apply)
    gtk_object_set_data_full (GTK_OBJECT (widget), HistoryID,
			      g_strdup (history_id),
			      history_id ? g_free : NULL);

  max_saved = gb_widget_input_int (data, MaxSaved);
  if (data->apply)
    gtk_object_set_data (GTK_OBJECT (widget), MaxSaved,
			 GINT_TO_POINTER (max_saved));
}
Exemple #3
0
void StartProgress(char *message, int canstop)
{
GtkWidget *label;
GtkWidget *table;
GtkWidget *window;
GtkAdjustment *adj;
GtkWidget *sbut;
GtkWidget *hseparator2;

pdata= g_malloc (sizeof (typProgressData));
pdata->nLastPct= -1;
pdata->bProgressUp=TRUE;

window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
pdata->window=window;

gtk_signal_connect(GTK_OBJECT (window), "delete_event",
              GTK_SIGNAL_FUNC ((gint)CanWindowClose), pdata);
gtk_container_border_width(GTK_CONTAINER (window),10);

table=gtk_table_new(4,2,TRUE);
gtk_container_add(GTK_CONTAINER(window),table);

label=gtk_label_new(message);
gtk_table_attach_defaults (GTK_TABLE(table),label,0,2,0,1);
gtk_widget_show(label);

adj= (GtkAdjustment *) gtk_adjustment_new (0,0,400,0,0,0);
pdata->progressbar= gtk_progress_bar_new_with_adjustment(adj);
gtk_table_attach_defaults(GTK_TABLE(table),pdata->progressbar,0,2,1,2);
gtk_widget_show(pdata->progressbar);

 if(canstop==TRUE) { 
   hseparator2 = gtk_hseparator_new ();
   gtk_widget_ref (hseparator2);
   gtk_object_set_data_full (GTK_OBJECT (window), "hseparator2", hseparator2,
			     (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_show (hseparator2);
   gtk_table_attach (GTK_TABLE (table), hseparator2, 0, 2, 2, 3,
		     (GtkAttachOptions) (GTK_FILL),
		     (GtkAttachOptions) (GTK_FILL), 0, 0);
   
   sbut = gtk_button_new_with_label (("stop me...!"));
   gtk_widget_ref (sbut);
   gtk_object_set_data_full (GTK_OBJECT (window), "sbut", sbut,
			     (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_show (sbut);
   gtk_table_attach (GTK_TABLE (table), sbut, 0, 2, 3, 4,
		     (GtkAttachOptions) (GTK_FILL),
		     (GtkAttachOptions) (GTK_FILL), 0, 0);
   gtk_signal_connect (GTK_OBJECT (sbut), "clicked",GTK_SIGNAL_FUNC (stop_process),NULL);
 }

gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
gtk_widget_show(table);
 gtk_grab_add (window);
gtk_widget_show(window);

}
Exemple #4
0
GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *quit;
  GtkWidget *entry1;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (window1), "window1", window1);
  gtk_window_set_title (GTK_WINDOW (window1), _("window1"));

  table1 = gtk_table_new (6, 3, FALSE);
  gtk_widget_ref (table1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "table1", table1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table1);
  gtk_container_add (GTK_CONTAINER (window1), table1);

  label1 = gtk_label_new (_("label1"));
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  quit = gtk_button_new_with_label (_("button1"));
  gtk_widget_ref (quit);
  gtk_object_set_data_full (GTK_OBJECT (window1), "quit", quit,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (quit);
  gtk_table_attach (GTK_TABLE (table1), quit, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  entry1 = gtk_entry_new ();
  gtk_widget_ref (entry1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "entry1", entry1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry1);
  gtk_table_attach (GTK_TABLE (table1), entry1, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  gtk_signal_connect (GTK_OBJECT (window1), "delete_event",
                      GTK_SIGNAL_FUNC (on_window1_delete_event),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (quit), "clicked",
                      GTK_SIGNAL_FUNC (on_button1_clicked),
                      NULL);

  return window1;
}
Exemple #5
0
GtkWidget* dialogAllianceCreate (void) {
  GtkWidget *dialogAlliance;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *button1;
  GtkWidget *button2;

  dialogAlliance = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (dialogAlliance), "dialogAlliance", dialogAlliance);
  gtk_container_set_border_width (GTK_CONTAINER (dialogAlliance), 15);
  gtk_window_set_title (GTK_WINDOW (dialogAlliance), "Alliance Request");

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

  label1 = gtk_label_new ("%s requests alliance. Accept?\n");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (dialogAlliance), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);

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

  button1 = gtk_button_new_with_label ("Accept");
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (dialogAlliance), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_box_pack_start (GTK_BOX (hbox1), button1, TRUE, TRUE, 0);
  GTK_WIDGET_UNSET_FLAGS (button1, GTK_CAN_FOCUS);

  button2 = gtk_button_new_with_label ("Reject");
  gtk_widget_ref (button2);
  gtk_object_set_data_full (GTK_OBJECT (dialogAlliance), "button2", button2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button2);
  gtk_box_pack_start (GTK_BOX (hbox1), button2, TRUE, TRUE, 0);

  gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(dialogAllianceAccept), 0);
  gtk_signal_connect(GTK_OBJECT(button2), "clicked", GTK_SIGNAL_FUNC(dialogAllianceReject), 0);

  dialogAllianceUs = dialogAlliance;
  return dialogAlliance;
}
Exemple #6
0
GtkWidget * gw_menu_options_create ( GtkWindow *w, GtkAccelGroup *ag, GtkWidget *parent)
{
	GtkWidget *gw_menu_options_header = NULL;
	GtkWidget *menu_options = NULL;
	GtkWidget *gw_menu_options_settings = NULL;
	GtkAccelGroup *gw_menu_options_ag = NULL;
	guint tmp_key;
	gchar *text_utf8 = NULL;


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

	if ( w != NULL )
	{
		/* Menu action header */
		gw_menu_options_header = gtk_menu_item_new_with_label ( "");
		g_strdup_to_gtk_text ( _( "_Options"), text_utf8);
		tmp_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( gw_menu_options_header)->child), text_utf8);
		g_free ( text_utf8);
#if defined ( HAVE_GTK12)
		gtk_widget_add_accelerator ( gw_menu_options_header, "activate-item", ag, tmp_key, GDK_MOD1_MASK, 0);
#endif
		gtk_widget_ref ( gw_menu_options_header);
		gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_OPTIONS_MENU_HEADER, gw_menu_options_header, (GtkDestroyNotify) gtk_widget_unref);

		menu_options = gtk_menu_new ( );
		gtk_widget_ref ( menu_options);
		gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_OPTIONS_MENU, menu_options, (GtkDestroyNotify) gtk_widget_unref);
		gtk_menu_item_set_submenu ( GTK_MENU_ITEM ( gw_menu_options_header), menu_options);
#if defined ( HAVE_GTK12)
		gw_menu_options_ag = gtk_menu_ensure_uline_accel_group ( GTK_MENU ( menu_options));
#else
		gw_menu_options_ag = gtk_accel_group_new ( );
#endif

		/* Menu action -> edit categories */
		gw_menu_options_settings = gtk_menu_item_new_with_label ( "");
		g_strdup_to_gtk_text ( _( "Se_ttings"), text_utf8);
		tmp_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( gw_menu_options_settings)->child), text_utf8);
		g_free ( text_utf8);
#if defined ( HAVE_GTK12)
		gtk_widget_add_accelerator ( gw_menu_options_settings, "activate-item", gw_menu_options_ag, tmp_key, 0, 0);
#endif
		gtk_widget_ref ( gw_menu_options_settings);
		gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_OPTIONS_MENU_SETTINGS, gw_menu_options_settings, (GtkDestroyNotify) gtk_widget_unref);
		gtk_container_add ( GTK_CONTAINER ( menu_options), gw_menu_options_settings);
		gtk_widget_add_accelerator ( gw_menu_options_settings, "activate", ag, GDK_t, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
		gtk_signal_connect ( GTK_OBJECT ( gw_menu_options_settings), "activate", GTK_SIGNAL_FUNC ( gw_menu_options_settings_click), w);
	}

	return gw_menu_options_header;
}
Exemple #7
0
GtkWidget * gw_menu_help_create ( GtkWindow *w, GtkAccelGroup *ag, GtkWidget *parent)
{
	GtkWidget *gw_menu_help_header = NULL;
	GtkWidget *menu_help = NULL;
	GtkWidget *gw_menu_help_about = NULL;
	GtkAccelGroup *gw_menu_help_ag = NULL;
	guint tmp_key;
	gchar *text_utf8 = NULL;


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

	/* Menu help header */
	gw_menu_help_header = gtk_menu_item_new_with_label ( "");
	g_strdup_to_gtk_text ( _( "_Help"), text_utf8);
	tmp_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( gw_menu_help_header)->child), text_utf8);
	g_free ( text_utf8);
#if defined ( HAVE_GTK12)
	gtk_widget_add_accelerator ( gw_menu_help_header, "activate-item", ag, tmp_key, GDK_MOD1_MASK, 0);
#endif
	gtk_widget_ref ( gw_menu_help_header);
	gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_HELP_MENU_HEADER, gw_menu_help_header, (GtkDestroyNotify) gtk_widget_unref);

	menu_help = gtk_menu_new ( );
	gtk_widget_ref ( menu_help);
	gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_HELP_MENU, menu_help, (GtkDestroyNotify) gtk_widget_unref);
	gtk_menu_item_set_submenu ( GTK_MENU_ITEM ( gw_menu_help_header), menu_help);

#if defined ( HAVE_GTK12)
	gw_menu_help_ag = gtk_menu_ensure_uline_accel_group ( GTK_MENU ( menu_help));
#else
	gw_menu_help_ag = gtk_accel_group_new ( );
#endif

	/* Menu help -> about */
	gw_menu_help_about = gtk_menu_item_new_with_label ( "");
	g_strdup_to_gtk_text ( _( "A_bout"), text_utf8);
	tmp_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( gw_menu_help_about)->child), text_utf8);
	g_free ( text_utf8);
#if defined ( HAVE_GTK12)
	gtk_widget_add_accelerator ( gw_menu_help_about, "activate-item", gw_menu_help_ag, tmp_key, 0, 0);
#endif
	gtk_widget_ref ( gw_menu_help_about);
	gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_MENU_BAR_HELP_MENU_ABOUT, gw_menu_help_about, (GtkDestroyNotify) gtk_widget_unref);
	gtk_container_add ( GTK_CONTAINER ( menu_help), gw_menu_help_about);
	gtk_widget_add_accelerator ( gw_menu_help_about, "activate", ag, GDK_b, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
	gtk_signal_connect ( GTK_OBJECT ( gw_menu_help_about), "activate", GTK_SIGNAL_FUNC ( gw_menu_help_about_click), w);

	return gw_menu_help_header;
}
Exemple #8
0
void
create_ui_context_menu(GtkWidget *parent_window)
{
    ui_context_menu = gtk_menu_new();
    gtk_widget_ref (ui_context_menu);
    gtk_object_set_data_full (GTK_OBJECT (parent_window), "ui_context_menu", ui_context_menu,
                              (GtkDestroyNotify) gtk_widget_unref);
    ui_context_menu_launch = gtk_menu_item_new_with_label ("Launch UI");
    gtk_widget_show (ui_context_menu_launch);
    gtk_menu_append (GTK_MENU (ui_context_menu), ui_context_menu_launch);
    ui_context_menu_show = gtk_menu_item_new_with_label ("Show UI");
    gtk_widget_show (ui_context_menu_show);
    gtk_menu_append (GTK_MENU (ui_context_menu), ui_context_menu_show);
    ui_context_menu_hide = gtk_menu_item_new_with_label ("Hide UI");
    gtk_widget_show (ui_context_menu_hide);
    gtk_menu_append (GTK_MENU (ui_context_menu), ui_context_menu_hide);
    ui_context_menu_exit = gtk_menu_item_new_with_label ("Exit UI");
    gtk_widget_show (ui_context_menu_exit);
    gtk_menu_append (GTK_MENU (ui_context_menu), ui_context_menu_exit);

    gtk_signal_connect (GTK_OBJECT (ui_context_menu_launch), "activate",
                        GTK_SIGNAL_FUNC (on_ui_context_menu_activate),
                        (gpointer)0);
    gtk_signal_connect (GTK_OBJECT (ui_context_menu_show), "activate",
                        GTK_SIGNAL_FUNC (on_ui_context_menu_activate),
                        (gpointer)1);
    gtk_signal_connect (GTK_OBJECT (ui_context_menu_hide), "activate",
                        GTK_SIGNAL_FUNC (on_ui_context_menu_activate),
                        (gpointer)2);
    gtk_signal_connect (GTK_OBJECT (ui_context_menu_exit), "activate",
                        GTK_SIGNAL_FUNC (on_ui_context_menu_activate),
                        (gpointer)3);
}
static void
add_to_menu(GtkWidget* menu, GnomeRecentDocument *doc)
{
        GtkWidget *mi;
        const gchar* name;
        GtkWidget *label;
        
        name = gnome_recent_document_peek(doc, "menu-text");

        label = gtk_label_new(name);
        mi = gtk_menu_item_new();

        gtk_container_add(GTK_CONTAINER(mi), label);
        
        /* ref for the menu item */
        gnome_recent_document_ref(doc);
        gtk_object_set_data_full(GTK_OBJECT(mi), "doc", 
                                 doc,
                                 (GtkDestroyNotify)gnome_recent_document_unref);

        gtk_object_set_data(GTK_OBJECT(mi), "label", label);
        
        gtk_widget_show_all(mi);

        g_hash_table_insert(doc_to_menuitem, doc, mi);
        
        /* FIXME actually we'd want to sort by time... */
        gtk_menu_shell_append(GTK_MENU_SHELL (menu), mi);
}
GtkWidget * gw_notebook_managment_create_and_add ( GtkWindow *window, GtkNotebook *parent)
{
	GtkWidget *tabbed_pane = NULL;
	GtkWidget *managment_tabbed_pane_label;
	gchar *text_utf8 = NULL;


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

	if ( window != NULL )
	{
		tabbed_pane = gw_notebook_managment_create ( window);

		if ( (parent != NULL) && (tabbed_pane != NULL) )
		{
			gtk_container_add ( GTK_CONTAINER ( parent), tabbed_pane);

			/* Text label of the managment tabbed pane. */
			g_strdup_to_gtk_text ( _( "Management"), text_utf8);
			managment_tabbed_pane_label = gtk_label_new ( text_utf8);
			g_free ( text_utf8);

			/* Store reference to the title of tabbed pane */
			gtk_widget_ref ( managment_tabbed_pane_label);
			gtk_object_set_data_full ( GTK_OBJECT ( window), GW_REF_NOTEBOOK_MANAGMENT_TABBED_PANE_LABEL, managment_tabbed_pane_label,(GtkDestroyNotify) gtk_widget_unref);
			gtk_notebook_set_tab_label ( parent, gtk_notebook_get_nth_page ( parent, 2), managment_tabbed_pane_label);
		}
	}

	return tabbed_pane;
}
Exemple #11
0
/**
 * Sets up the icon and canvas widgets.  This function was
 * generated by glade separatly from the main gui since the icon
 * widgets are independent of the rest of the gui, and there
 * are unresolved issues between GTK and GTK2.
 */
static void
create_icon(void)
{
    icon = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_name(icon, "icon");
    gtk_object_set_data(GTK_OBJECT(icon), "icon", icon);
    gtk_widget_set_usize(icon, ICON_WIDTH + 1, ICON_HEIGHT + 1);
    gtk_widget_set_sensitive(icon, FALSE);
    GTK_WIDGET_SET_FLAGS(icon, GTK_CAN_FOCUS);
    GTK_WIDGET_SET_FLAGS(icon, GTK_CAN_DEFAULT);
    gtk_widget_set_events(icon, GDK_VISIBILITY_NOTIFY_MASK);
    gtk_window_set_title(GTK_WINDOW(icon), "icon");
    gtk_window_set_default_size(GTK_WINDOW(icon),
                                ICON_WIDTH + 1, ICON_HEIGHT + 1);
    gtk_window_set_policy(GTK_WINDOW(icon), FALSE, FALSE, FALSE);

    canvas = gtk_drawing_area_new();
    gtk_widget_set_name(canvas, "canvas");
    gtk_widget_ref(canvas);
    gtk_object_set_data_full(GTK_OBJECT(icon), "canvas", canvas,
                             (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show(canvas);
    gtk_container_add(GTK_CONTAINER(icon), canvas);
    gtk_widget_set_events(canvas, GDK_EXPOSURE_MASK);

    gui_signal_connect(icon, "map_event", on_icon_map_event, NULL);
    gui_signal_connect(icon, "unmap_event", on_icon_unmap_event, NULL);
    gui_signal_connect(canvas, "expose_event", on_canvas_expose_event, NULL);
}
Exemple #12
0
void tree_select( GtkTree *tree, xmlNode *action)
{
  int i = 0;
  
  if ( strcmp (action->name, "action") != 0) {
  	gtk_widget_destroy(table[cur_pid].page.text1);
	table[cur_pid].page.text1 = gtk_html_new ();
  	gtk_widget_set_name (table[cur_pid].page.text1, "text1");
  	gtk_widget_ref (table[cur_pid].page.text1);
  	gtk_object_set_data_full (GTK_OBJECT (Peos), "text1", table[cur_pid].page.text1,
                           	(GtkDestroyNotify) gtk_widget_unref);
  	gtk_widget_show (table[cur_pid].page.text1);
  	gtk_container_add (GTK_CONTAINER (table[cur_pid].page.scrollwindow2), table[cur_pid].page.text1);
	deactivate();
  }

  else  {
	table[cur_pid].page.curr = action;
	/* set index to save position when destroyed */
	if (table[cur_pid].process != NULL ) {
		if(process_count > 0) while(linklist[cur_pid][i].cur != table[cur_pid].page.curr && i <= counting_action) i++;
		table[cur_pid].page.index = i;
		draw_text(action);
  		check_state();
	}
  } 
}
gint gw_plugin_settings_quick_search_pane_load ( GtkWidget *pane)
{
    gint result = -1;
    GtkCList *list_visible = NULL;
    GtkCList *list_hidden = NULL;
    GtkCList *list = NULL;
    GWSettingsExplorerField **fields;
    gint i;


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

    if ( pane != NULL )
    {
        list_visible = GTK_CLIST ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_LIST_VISIBLE));
        list_hidden = GTK_CLIST ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_LIST_HIDDEN));

        if ( (list_visible != NULL) && (list_hidden != NULL) )
        {
            if ( (fields = gw_plugin_settings_search_get_all_fields ( )) != NULL )
            {
                gtk_object_set_data_full ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_QUICK_SEARCH_FIELDS_TABLE, fields, (GtkDestroyNotify) gw_settings_explorer_field_freev);

                gtk_clist_freeze ( list_visible);
                gtk_clist_freeze ( list_hidden);

                for ( i = 0; fields[i] != NULL; i++)
                {
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
                    g_print ( "*** GW - %s (%d) :: %s() : adding the field %s to the list visible/hidden\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, fields[i]->name);
#endif

                    if ( fields[i]->visible == TRUE )
                    {
                        list = list_visible;
                    }
                    else
                    {
                        list = list_hidden;
                    }

                    gtk_clist_append ( list, &fields[i]->name);
                }

                gtk_clist_thaw ( list_visible);
                gtk_clist_thaw ( list_hidden);
            }

#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
            g_print ( "*** GW - %s (%d) :: %s() : all fields are loaded.\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif
        }

        result = 0;
    }

    return result;
}
static void server_browse_entry_popup(GqBrowserNode *e,
				      GtkWidget *menu,
				      GQTreeWidget *ctreeroot,
				      GQTreeWidgetNode *ctree_node,
				      GqTab *tab)
{
     GtkWidget *menu_item;
     GqServer *server;
     struct edit_server_cb_data *cbd;
     GqBrowserNodeServer *entry;

     g_assert(GQ_IS_BROWSER_NODE_SERVER(e));
     entry = GQ_BROWSER_NODE_SERVER(e);

     server = server_from_node(ctreeroot, ctree_node);

     /* Edit Server settings */
     menu_item = gtk_menu_item_new_with_label(_("Edit Server"));
     gtk_menu_append(GTK_MENU(menu), menu_item);
     gtk_widget_show(menu_item);

     cbd = (struct edit_server_cb_data *)
	  g_malloc0(sizeof(struct edit_server_cb_data));
     cbd->server = g_object_ref(server);
     cbd->tab = tab;

     g_signal_connect_swapped(menu_item, "activate",
			       G_CALLBACK(edit_server_activated),
			       cbd);

     /* explicitly attach cbd to assure call to destructor */
     gtk_object_set_data_full(GTK_OBJECT(menu_item), "cbd",
			      cbd, (GtkDestroyNotify)free_edit_server_cb_data);

     gtk_widget_show(menu_item);

     if (server == NULL) {
	  gtk_widget_set_sensitive(menu_item, FALSE);
     }

     /* Export to LDIF */
     menu_item = gtk_menu_item_new_with_label(_("Export to LDIF"));
     gtk_menu_append(GTK_MENU(menu), menu_item);
     g_signal_connect(menu_item, "activate",
			G_CALLBACK(dump_server),
			tab);
     gtk_widget_show(menu_item);

     /* Close connection */
     menu_item = gtk_menu_item_new_with_label(_("Close Connection"));
     gtk_menu_append(GTK_MENU(menu), menu_item);
     g_signal_connect(menu_item, "activate",
			G_CALLBACK(tree_row_close_connection),
			tab);
     gtk_widget_show(menu_item);

     if (server == NULL) {
	  gtk_widget_set_sensitive(menu_item, FALSE);
     }
}
Exemple #15
0
static GtkWidget *
create_scripts_submenu (ThumbView * tv)
{
    GtkWidget *menu;
    GtkWidget *menu_item;
    GList  *tmplist = NULL, *filelist = NULL, *list;
    gchar **dirs;
    gint    i, flags;

    menu = gtk_menu_new ();

    dirs = g_strsplit (conf.scripts_search_dir_list, ",", -1);
    if (!dirs)
	return NULL;

    flags = 0 | GETDIR_FOLLOW_SYMLINK;
    for (i = 0; dirs[i]; i++)
    {
	if (!*dirs || !isdir (dirs[i]))
	    continue;
	get_dir (dirs[i], flags, &tmplist, NULL);
	filelist = g_list_concat (filelist, tmplist);
    }
    g_strfreev (dirs);

    for (list = filelist; list; list = g_list_next (list))
    {
	gchar  *filename = list->data;
	gchar  *label;

	if (!filename || !*filename || !isexecutable (filename))
	    continue;

	if (conf.scripts_show_dialog)
	    label = g_strconcat (g_basename (filename), "...", NULL);
	else
	    label = g_strdup (g_basename (filename));

	menu_item = gtk_menu_item_new_with_label (label);
	gtk_object_set_data_full (GTK_OBJECT (menu_item),
				  "script",
				  g_strdup (filename),
				  (GtkDestroyNotify) g_free);
	gtk_signal_connect (GTK_OBJECT (menu_item),
			    "activate",
			    GTK_SIGNAL_FUNC (cb_open_image_by_script), tv);
	gtk_menu_append (GTK_MENU (menu), menu_item);
	gtk_widget_show (menu_item);

	g_free (label);
    }

    g_list_foreach (filelist, (GFunc) g_free, NULL);
    g_list_free (filelist);

    return menu;
}
Exemple #16
0
void
create_about_window(const char *tag)
{
    GtkWidget *vbox2;
    GtkWidget *closeabout;

    about_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_object_set_data (GTK_OBJECT (about_window), "about_window", about_window);
    gtk_window_set_title (GTK_WINDOW (about_window), "About ghostess");

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_widget_ref (vbox2);
    gtk_object_set_data_full (GTK_OBJECT (about_window), "vbox2", vbox2,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (vbox2);
    gtk_container_add (GTK_CONTAINER (about_window), vbox2);

    about_label = gtk_label_new ("Some message\ngoes here");
    gtk_widget_ref (about_label);
    gtk_object_set_data_full (GTK_OBJECT (about_window), "about_label", about_label,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (about_label);
    gtk_box_pack_start (GTK_BOX (vbox2), about_label, FALSE, FALSE, 0);
    gtk_label_set_line_wrap (GTK_LABEL (about_label), TRUE);
    gtk_label_set_justify (GTK_LABEL (about_label), GTK_JUSTIFY_CENTER);
    gtk_misc_set_padding (GTK_MISC (about_label), 5, 5);

    closeabout = gtk_button_new_with_label ("Dismiss");
    gtk_widget_ref (closeabout);
    gtk_object_set_data_full (GTK_OBJECT (about_window), "closeabout", closeabout,
                              (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show (closeabout);
    gtk_box_pack_start (GTK_BOX (vbox2), closeabout, FALSE, FALSE, 0);

    gtk_signal_connect (GTK_OBJECT (about_window), "destroy",
                        GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
    gtk_signal_connect (GTK_OBJECT (about_window), "delete_event",
                        GTK_SIGNAL_FUNC (on_delete_event_wrapper),
                        (gpointer)on_about_dismiss);
    gtk_signal_connect (GTK_OBJECT (closeabout), "clicked",
                        GTK_SIGNAL_FUNC (on_about_dismiss),
                        NULL);
}
Exemple #17
0
GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *scrolledwindow1;
  GtkWidget *text1;
  GtkWidget *dialog_action_area1;

  dialog1 = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog1", dialog1);
  gtk_window_set_title (GTK_WINDOW (dialog1), _("dialog1"));
  gtk_window_set_policy (GTK_WINDOW (dialog1), TRUE, TRUE, FALSE);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "scrolledwindow1", scrolledwindow1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);
  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 (dialog1), "text1", text1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (text1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), text1);
  gtk_text_set_editable (GTK_TEXT (text1), TRUE);

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

  return dialog1;
}
Exemple #18
0
/* This is called by the drop handler function clist_drag_data_received */
static void
create_drag_op_menu(gchar *dest_dir, gchar *file_list)
{
  GtkWidget *item;

  if (app.drag_op_menu != NULL)
    gtk_widget_destroy(app.drag_op_menu);

  app.drag_op_menu = gtk_menu_new();
  item = add_menu_item(app.drag_op_menu, _("Copy"), drag_op_cb, file_copy);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);
  item = add_menu_item(app.drag_op_menu, _("Move"), drag_op_cb, file_move);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);
  item = add_menu_item(app.drag_op_menu, _("SymLink"), drag_op_cb, file_symlink);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir", g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list", g_strdup(file_list),
                           free_data);

  gtk_menu_popup(GTK_MENU(app.drag_op_menu), NULL, NULL, NULL, NULL, 0, 0);
}
Exemple #19
0
void create_hsep(GtkWidget *vbox)
{
  GtkWidget *hsep1;

  hsep1=gtk_hseparator_new();
  gtk_widget_ref (hsep1);
  gtk_object_set_data_full (GTK_OBJECT (window1), "hsep1", hsep1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_box_pack_start (GTK_BOX (vbox), hsep1, TRUE, TRUE,0);
  gtk_widget_show (hsep1);  

return;
}
Exemple #20
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_combo_box_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *items;
  gboolean add_tearoffs, focus_on_click;

  items = gb_widget_input_text (data, Items);
  if (data->apply)
    {
      GtkTreeModel *model;
      gchar *pos = items;
      gchar *items_end = &items[strlen (items)];

      /* Save a copy so it is easy to get out later. */
      gtk_object_set_data_full (GTK_OBJECT (widget), Items,
				g_strdup (items), g_free);

      /* Clear the list. */
      model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
      gtk_list_store_clear (GTK_LIST_STORE (model));

      /* Now add the items one at a time. */
      while (pos < items_end)
	{
	  gchar *item_end = strchr (pos, '\n');
	  if (item_end == NULL)
	    item_end = items_end;
	  *item_end = '\0';

	  gtk_combo_box_append_text (GTK_COMBO_BOX (widget), pos);

	  if (item_end != items_end)
	    *item_end = '\n';

	  pos = item_end + 1;
	}
    }
  if (data->action == GB_APPLYING)
    g_free (items);

  add_tearoffs = gb_widget_input_bool (data, AddTearoffs);
  if (data->apply)
    gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (widget), add_tearoffs);

  focus_on_click = gb_widget_input_bool (data, FocusOnClick);
  if (data->apply)
    gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (widget), focus_on_click);
}
static GtkWidget*
entry_attached_to(GConfClient* client, const gchar* key)
{
  GtkWidget* entry;
  GtkWidget* hbox;
  GtkWidget* label;
  gchar* val;
  guint notify_id;
  
  entry = gtk_entry_new();

  gtk_object_set_data_full(GTK_OBJECT(entry), "key",
                           g_strdup(key), g_free);


  val = gconf_client_get_string(client, key, NULL);

  gtk_entry_set_text(GTK_ENTRY(entry), val ? val : "");

  g_free(val);
  
  notify_id = gconf_client_notify_add(client, key, entry_notify_func, entry, NULL, NULL);

  gtk_object_set_data(GTK_OBJECT(entry), "notify_id",
                      GUINT_TO_POINTER(notify_id));
  
  gtk_signal_connect(GTK_OBJECT(entry), "changed",
                     GTK_SIGNAL_FUNC(entry_changed_callback),
                     client);

  gtk_signal_connect(GTK_OBJECT(entry), "destroy",
                     GTK_SIGNAL_FUNC(entry_destroyed_callback),
                     client);
  
  hbox = gtk_hbox_new(FALSE, 10);

  label = gtk_label_new(key);

  gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
  gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);

  /* Set sensitive according to whether the key is writable or not. */
  gtk_widget_set_sensitive (entry,
                            gconf_client_key_is_writable (client,
                                                          key, NULL));
  
  return hbox;
}
Exemple #22
0
void
on_ok_delete_clicked(void)
{
  runPeos(del_cmd);

  /* I changed this: it was before parse in the function */
  gtk_widget_destroy (notebook);
  freeAll_extra();

  notebook = create_notebook();
  gtk_widget_set_name (notebook, "notebook");
  gtk_widget_ref (notebook);
  gtk_object_set_data_full (GTK_OBJECT (Peos), "notebook", notebook,
                            (GtkDestroyNotify) gtk_widget_unref);
  set_selection(1);	/* with current action selected */
  gtk_container_add (GTK_CONTAINER (vbox), notebook);

  redisplay_menu();
}
Exemple #23
0
static GtkWidget *dt_date_get_widget(int error_context,
				     struct formfill *form,
				     GByteArray *data,
				     GtkSignalFunc *activatefunc,
				     gpointer funcdata)
{
     GtkWidget *hbox, *inputbox, *button;
     cbdata *cbd;

     hbox = gtk_hbox_new(FALSE, 5);

     inputbox = gtk_entry_new();
     if(activatefunc)
	  gtk_signal_connect_object(GTK_OBJECT(inputbox), "activate",
				    GTK_SIGNAL_FUNC(activatefunc),
				    (gpointer) funcdata);

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

     button = gtk_button_new_with_label("...");
     gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, TRUE, 0);

     cbd = g_malloc(sizeof(cbdata));
     cbd->form = form;
     cbd->hbox = hbox;

     gtk_signal_connect(GTK_OBJECT(button), "clicked",
			GTK_SIGNAL_FUNC(dt_date_edit_window),
			(gpointer) cbd);

     gtk_object_set_data_full(GTK_OBJECT(hbox), "cbdata", cbd, g_free);

     gtk_widget_show(button);

     gtk_object_set_data(GTK_OBJECT(hbox), "inputbox", inputbox);
     gtk_object_set_data(GTK_OBJECT(hbox), "button", button);

     dt_date_set_data(form, data, hbox);

     return hbox;
}
Exemple #24
0
GtkWidget *InsereCommentdansFormulaire(GtkWidget * fenetre, GtkWidget * table, TxChampsFormulaire * champs)
{
  GtkTextBuffer *buffer;
  GtkWidget *view1,*sw;
  GtkTextIter iter;
 
  champs->fenetre = fenetre;
  champs->table = table;
  champs->print_widget_entry = gtk_label_new(champs->nom_champs);

  gtk_widget_ref(champs->print_widget_entry);
  gtk_object_set_data_full(GTK_OBJECT(fenetre), champs->nom_champs, champs->print_widget_entry, (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(champs->print_widget_entry);

  gtk_table_attach(GTK_TABLE(table), champs->print_widget_entry, champs->x,
                     champs->x + 1, champs->y, champs->y + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(champs->print_widget_entry), 0, 0.5);

  view1 = gtk_text_view_new ();
  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view1));
  /*champs->widget_entry =(GtkWidget *) buffer;*/
  champs->widget_entry =(GtkWidget *) view1;

      /* attention il faudrait reutiliser l'ancien buffer ou liberer le buffer ! */
  sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
				      GTK_POLICY_AUTOMATIC,
				      GTK_POLICY_AUTOMATIC);

  gtk_text_buffer_get_start_iter (buffer, &iter);
  gtk_text_buffer_insert (buffer, &iter, "Les commentaires doivent etre mis ici.\n", -1);

  gtk_widget_show(view1);

  gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), view1);
  gtk_widget_show(sw);
  return sw ;

}
Exemple #25
0
void dt_clist_store_data(struct formfill *form, 
			 GtkWidget *hbox,
			 GtkWidget *data_widget,
			 const GByteArray *data)
{
     GtkCList *clist = (GtkCList*) GTK_BIN(data_widget)->child;
     int i;

     gtk_clist_freeze(clist);
     gtk_clist_clear(clist);

     gtk_object_remove_data(GTK_OBJECT(data_widget), "data"); 

     if(data) {
	  GByteArray *internal = g_byte_array_new();
	  g_byte_array_append(internal, data->data, data->len);

	  gtk_object_set_data_full(GTK_OBJECT(data_widget), "data", 
				   internal,
				   (GtkDestroyNotify) free_internal_data);
	  if (internal->len > 0) {
	       GQTypeDisplayClass* klass = g_type_class_ref(form->dt_handler);
	       if (DT_CLIST(klass)->fill_clist) {
		    DT_CLIST(klass)->fill_clist(form, hbox,
							   data_widget,
							   internal, 
							   GTK_WIDGET(clist));
	       }
	       g_type_class_unref(klass);
	  }

	  for ( i = 0 ; i < 2 ; i ++ ) {
	       gtk_clist_set_column_width(GTK_CLIST(clist), i, 
					  gtk_clist_optimal_column_width(clist, i));
	  }
     }
     gtk_clist_thaw(clist);
}
Exemple #26
0
static void
gb_gnome_app_add_toolbar_button (GtkToolbar *toolbar,
				 const gchar *stock_id,
				 const gchar *tooltip)
{
  GtkWidget *button;
  GladeWidgetData *wdata;

  button = gb_widget_new ("GtkToolButton", NULL);

  gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (button), stock_id);
  gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (button), NULL);
  gtk_tool_button_set_label (GTK_TOOL_BUTTON (button), NULL);

  gtk_object_set_data_full (GTK_OBJECT (button),
			    GladeToolButtonStockIDKey,
			    g_strdup (stock_id), g_free);

  wdata = gtk_object_get_data (GTK_OBJECT (button), GB_WIDGET_DATA_KEY);
  wdata->tooltip = g_strdup (tooltip);

  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (button), -1);
}
Exemple #27
0
void gaborrg_maker_gui_setup (GrmGui* gui, MalibObject* handler)
{
  MalibGtkDisplay** displays= gui->displays;

  /* window 1 */
  {
    GtkWidget * fixed1, * viewport2, * drawingarea1, * malib_drawingarea;
    gtk_widget_show(gui->window);

    gtk_signal_connect(GTK_OBJECT (gui->window), "delete_event",
		       GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

    fixed1=       lookup_widget(gui->window, "fixed1");
    viewport2=    lookup_widget(fixed1, "viewport2");
    drawingarea1= lookup_widget(viewport2, "drawingarea1");
    malib_drawingarea= GTK_WIDGET (malib_gtkdisplay_get_drawarea (displays[GRM_DEFAULT_DISPLAY_NUM]));
      
    gtk_container_remove(GTK_CONTAINER (viewport2), drawingarea1);
    
    gtk_container_add (GTK_CONTAINER (viewport2), malib_drawingarea);
    gtk_signal_connect (GTK_OBJECT (viewport2), "button_press_event",
			GTK_SIGNAL_FUNC (drawingarea1_clicked), gui);
    
    gtk_widget_ref(malib_drawingarea);
    gtk_object_set_data_full (GTK_OBJECT(gui->window), "drawingarea1", malib_drawingarea,
			      (GtkDestroyNotify) gtk_widget_unref);
    
    gtk_widget_set_usize(viewport2, BTTV_DEFAULT_WIDTH,BTTV_DEFAULT_HEIGHT);
    
    /* setup right scrollwindow*/
    right_scroll_window_setup(gui);
    gaborrg_maker_file_io_gui_setup(gui);
    /*gtk_button_new();*/
  }
  
  return ;
}
Exemple #28
0
/* This checks if the widget associated with the given adjustment is
 * currently busy redrawing/reconfiguring itself, or is in steady state
 * (this is used when animating widgets to avoid changing the adjustment
 * too often, otherwise the widget can't keep up and things slow down) */
boolean
gui_adjustment_widget_busy( GtkAdjustment *adj )
{
	static const double threshold = (1.0 / 18.0);
	double t_prev;
	double t_now;
	double *tp;

	/* ---- HACK ALERT ----
	 * This doesn't actually check GTK+ internals-- I'm not sure which
	 * ones are relevant here. This just checks the amount of time that
	 * has passed since the last time the function was called with the
	 * same adjustment and returned FALSE, and if it's below a certain
	 * threshold, the object is considered "busy" (returning TRUE) */

	t_now = xgettime( );

	tp = gtk_object_get_data( GTK_OBJECT(adj), "t_prev" );
	if (tp == NULL) {
		tp = NEW(double);
		*tp = t_now;
		gtk_object_set_data_full( GTK_OBJECT(adj), "t_prev", tp, _xfree );
		return FALSE;
	}
Exemple #29
0
GtkWidget*
create_win_main (void)
{
  GtkWidget *win_main;
  GtkWidget *vbox1;
  GtkWidget *table1;
  GtkWidget *vbox2;
  GtkWidget *label_lang;
  GtkWidget *combo1;
  GtkWidget *combo_lang;
  GtkWidget *vbox3;
  GtkWidget *label_keyb;
  GtkWidget *combo2;
  GtkWidget *combo_keyb;
  GtkWidget *pixmap1;
  GtkWidget *pixmap2;
  GtkWidget *hbuttonbox1;
  guint button_ok_key;
  GtkWidget *button_ok;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  win_main = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (win_main, "win_main");
  gtk_object_set_data (GTK_OBJECT (win_main), "win_main", win_main);
  gtk_window_set_title (GTK_WINDOW (win_main), _("dyne:bolic :: lost in babylon"));
  gtk_window_set_position (GTK_WINDOW (win_main), GTK_WIN_POS_CENTER);
  gtk_window_set_policy (GTK_WINDOW (win_main), FALSE, FALSE, FALSE);
  gtk_window_set_wmclass (GTK_WINDOW (win_main), "babylon", "dynebolic");

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

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_set_name (table1, "table1");
  gtk_widget_ref (table1);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "table1", table1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (table1), 5);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox2, "vbox2");
  gtk_widget_ref (vbox2);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "vbox2", vbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox2);
  gtk_table_attach (GTK_TABLE (table1), vbox2, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);

  label_lang = gtk_label_new (_("Choose your language:"));
  gtk_widget_set_name (label_lang, "label_lang");
  gtk_widget_ref (label_lang);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "label_lang", label_lang,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_lang);
  gtk_box_pack_start (GTK_BOX (vbox2), label_lang, FALSE, FALSE, 0);

  combo1 = gtk_combo_new ();
  gtk_widget_set_name (combo1, "combo1");
  gtk_widget_ref (combo1);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "combo1", combo1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo1);
  gtk_box_pack_start (GTK_BOX (vbox2), combo1, FALSE, FALSE, 0);

  combo_lang = GTK_COMBO (combo1)->entry;
  gtk_widget_set_name (combo_lang, "combo_lang");
  gtk_widget_ref (combo_lang);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "combo_lang", combo_lang,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_lang);
  gtk_entry_set_editable (GTK_ENTRY (combo_lang), FALSE);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox3, "vbox3");
  gtk_widget_ref (vbox3);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "vbox3", vbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox3);
  gtk_table_attach (GTK_TABLE (table1), vbox3, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox3), 10);

  label_keyb = gtk_label_new (_("Choose your keyboard layout:"));
  gtk_widget_set_name (label_keyb, "label_keyb");
  gtk_widget_ref (label_keyb);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "label_keyb", label_keyb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label_keyb);
  gtk_box_pack_start (GTK_BOX (vbox3), label_keyb, FALSE, FALSE, 0);

  combo2 = gtk_combo_new ();
  gtk_widget_set_name (combo2, "combo2");
  gtk_widget_ref (combo2);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "combo2", combo2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo2);
  gtk_box_pack_start (GTK_BOX (vbox3), combo2, FALSE, FALSE, 0);

  combo_keyb = GTK_COMBO (combo2)->entry;
  gtk_widget_set_name (combo_keyb, "combo_keyb");
  gtk_widget_ref (combo_keyb);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "combo_keyb", combo_keyb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (combo_keyb);
  gtk_entry_set_editable (GTK_ENTRY (combo_keyb), FALSE);

  pixmap1 = create_pixmap (win_main, "locale.xpm");
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_table_attach (GTK_TABLE (table1), pixmap1, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  pixmap2 = create_pixmap (win_main, "charselect.xpm");
  gtk_widget_set_name (pixmap2, "pixmap2");
  gtk_widget_ref (pixmap2);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "pixmap2", pixmap2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap2);
  gtk_table_attach (GTK_TABLE (table1), pixmap2, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, FALSE, 0);

  button_ok = gtk_button_new_with_label ("");
  button_ok_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (button_ok)->child),
                                   _("_Ok"));
  gtk_widget_add_accelerator (button_ok, "clicked", accel_group,
                              button_ok_key, GDK_MOD1_MASK, (GtkAccelFlags) 0);
  gtk_widget_set_name (button_ok, "button_ok");
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (win_main), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_ok);
  gtk_container_set_border_width (GTK_CONTAINER (button_ok), 3);
  GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);

  gtk_signal_connect (GTK_OBJECT (win_main), "destroy",
                      GTK_SIGNAL_FUNC (gtk_main_quit),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo1), "realize",
                      GTK_SIGNAL_FUNC (on_combo1_realize),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo_lang), "changed",
                      GTK_SIGNAL_FUNC (on_combo_lang_changed),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo2), "realize",
                      GTK_SIGNAL_FUNC (on_combo2_realize),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (combo_keyb), "changed",
                      GTK_SIGNAL_FUNC (on_combo_keyb_changed),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_ok), "released",
                      GTK_SIGNAL_FUNC (on_button_ok_released),
                      NULL);

  gtk_window_add_accel_group (GTK_WINDOW (win_main), accel_group);

  return win_main;
}
Exemple #30
0
GtkWidget* dialogPasswordCreate(void) {
  GtkWidget *dailogPassword;
  GtkWidget *vbox1;
  GtkWidget *label1;
  GtkWidget *hbox1;
  GtkWidget *button1;

  dailogPassword = gtk_window_new (GTK_WINDOW_DIALOG);
  gtk_object_set_data (GTK_OBJECT (dailogPassword), "dailogPassword", dailogPassword);
  gtk_container_set_border_width (GTK_CONTAINER (dailogPassword), 7);
  gtk_window_set_title (GTK_WINDOW (dailogPassword), "Password");
  gtk_window_set_modal (GTK_WINDOW (dailogPassword), TRUE);
  gtk_window_set_policy (GTK_WINDOW (dailogPassword), FALSE, FALSE, FALSE);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dailogPassword), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (dailogPassword), vbox1);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 4);

  label1 = gtk_label_new ("This game is password protected.\nEnter the correct password to join:");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (dailogPassword), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);

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

  idc_passwordtxt = gtk_entry_new ();
  gtk_widget_ref (idc_passwordtxt);
  gtk_object_set_data_full (GTK_OBJECT (dailogPassword), "idc_passwordtxt", idc_passwordtxt,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_passwordtxt);
  gtk_box_pack_start (GTK_BOX (hbox1), idc_passwordtxt, TRUE, TRUE, 0);
  gtk_entry_set_visibility (GTK_ENTRY (idc_passwordtxt), FALSE);

  button1 = gtk_button_new_with_label ("OK");
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (dailogPassword), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_box_pack_start (GTK_BOX (hbox1), button1, TRUE, TRUE, 0);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);

  gtk_widget_grab_focus (idc_passwordtxt);
  gtk_widget_grab_default (button1);

  gtk_signal_connect(GTK_OBJECT(dailogPassword), "delete_event", GTK_SIGNAL_FUNC (dialogPasswordClose), NULL);
  gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(dialogPasswordClose), 0);
  gtk_signal_connect(GTK_OBJECT(idc_passwordtxt), "key-press-event", GTK_SIGNAL_FUNC(dialogPasswordKey), 0);

  dialogPasswordUs = dailogPassword;
  return dailogPassword;
}