2
/* GnomeMeeting -- A Video-Conferencing application
3
* Copyright (C) 2000-2006 Damien Sandras
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* GnomeMeting is licensed under the GPL license and as a special exception,
21
* you have permission to link or otherwise combine this program with the
22
* programs OpenH323 and Pwlib, and distribute the combination, without
23
* applying the requirements of the GNU GPL to the OpenH323 program, as long
24
* as you do follow the requirements of the GNU GPL for all the rest of the
25
* software thus combined.
30
* gnome_prefs_window.c - description
31
* ------------------------------------
32
* begin : Mon Oct 15 2003, but based on older code
33
* copyright : (C) 2000-2006 by Damien Sandras
34
* description : Helpers to create GNOME compliant prefs windows.
39
#include "gmpreferences.h"
41
#include "gmconfwidgets.h"
44
static void tree_selection_changed_cb (GtkTreeSelection *,
48
typedef struct _GnomePrefsWindow {
51
GtkWidget *section_label;
52
GtkWidget *sections_tree_view;
62
/* DESCRIPTION : This callback is called when the user clicks in the
63
* categories and subcategories GtkTreeView.
64
* BEHAVIOR : Display the logo if he clicked in a category, or the
65
* different blocks of options corresponding to a subcategory
66
* if he clicked in a specific subcategory.
70
tree_selection_changed_cb (GtkTreeSelection *selection,
76
GtkTreeModel *model = NULL;
77
GnomePrefsWindow *gpw = NULL;
82
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
84
gpw = (GnomePrefsWindow *) data;
86
gtk_tree_model_get (GTK_TREE_MODEL (model),
89
gtk_tree_model_get (GTK_TREE_MODEL (model),
92
gtk_label_set_text (GTK_LABEL (gpw->section_label), name);
94
gtk_notebook_set_current_page (GTK_NOTEBOOK (gpw->notebook), page);
99
/* The public functions */
101
gnome_prefs_entry_new (GtkWidget *table,
108
GnomePrefsWindow *gpw = NULL;
109
GValue value = { 0 };
111
GtkWidget *entry = NULL;
112
GtkWidget *label = NULL;
113
GtkWidget *hbox = NULL;
115
gchar *conf_string = NULL;
116
gboolean writable = FALSE;
118
writable = gm_conf_is_key_writable (conf_key);
122
hbox = gtk_hbox_new (FALSE, 0);
123
g_value_init (&value, G_TYPE_INT);
124
g_object_get_property (G_OBJECT (table), "n-columns", &value);
125
cols = g_value_get_int (&value);
126
g_value_unset (&value);
129
label = gtk_label_new_with_mnemonic (label_txt);
131
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
134
gtk_box_pack_start (GTK_BOX (hbox), label,
135
FALSE, FALSE, 1 * 2);
137
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
138
(GtkAttachOptions) (GTK_FILL),
139
(GtkAttachOptions) (GTK_FILL),
142
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
143
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
145
entry = gtk_entry_new ();
146
gtk_label_set_mnemonic_widget (GTK_LABEL(label), entry);
148
gtk_widget_set_sensitive (GTK_WIDGET (entry), FALSE);
151
gtk_box_pack_start (GTK_BOX (hbox), entry,
152
FALSE, FALSE, 1 * 2);
154
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, row, row+1,
155
(GtkAttachOptions) (NULL),
156
(GtkAttachOptions) (NULL),
160
gm_conf_get_string (conf_key);
162
if (conf_string != NULL)
163
gtk_entry_set_text (GTK_ENTRY (entry), conf_string);
165
g_free (conf_string);
167
g_signal_connect_after (G_OBJECT (entry), "focus-out-event",
168
G_CALLBACK (entry_focus_changed), conf_key);
170
g_signal_connect_after (G_OBJECT (entry), "activate",
171
G_CALLBACK (entry_activate_changed), conf_key);
173
gm_conf_notifier_add (conf_key, entry_changed_nt, (gpointer) entry);
176
gtk_table_attach (GTK_TABLE (table), hbox, 0, cols, row, row+1,
177
(GtkAttachOptions) (NULL),
178
(GtkAttachOptions) (NULL),
181
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
183
gtk_tooltips_set_tip (gpw->tips, entry, tooltip, NULL);
185
gtk_widget_show_all (table);
192
gnome_prefs_toggle_new (GtkWidget *table,
198
GnomePrefsWindow *gpw = NULL;
199
GValue value = { 0 };
200
GtkWidget *toggle = NULL;
201
gboolean writable = FALSE;
204
writable = gm_conf_is_key_writable (conf_key);
206
g_value_init (&value, G_TYPE_INT);
207
g_object_get_property (G_OBJECT (table), "n-columns", &value);
208
cols = g_value_get_int (&value);
209
g_value_unset (&value);
211
toggle = gtk_check_button_new_with_mnemonic (label_txt);
213
gtk_widget_set_sensitive (GTK_WIDGET (toggle), FALSE);
215
gtk_table_attach (GTK_TABLE (table), toggle, 0, cols, row, row+1,
216
(GtkAttachOptions) (GTK_FILL),
217
(GtkAttachOptions) (GTK_FILL),
220
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
221
gm_conf_get_bool (conf_key));
223
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
225
gtk_tooltips_set_tip (gpw->tips, toggle, tooltip, NULL);
227
g_signal_connect (G_OBJECT (toggle), "toggled",
228
G_CALLBACK (toggle_changed), (gpointer) conf_key);
230
gm_conf_notifier_add (conf_key, toggle_changed_nt, (gpointer) toggle);
232
gtk_widget_show_all (table);
239
gnome_prefs_scale_new (GtkWidget *table,
240
gchar *down_label_txt,
249
GnomePrefsWindow *gpw = NULL;
250
GtkWidget *hbox = NULL;
251
GtkAdjustment *adj = NULL;
252
GtkWidget *label = NULL;
253
GtkWidget *hscale = NULL;
255
gboolean writable = FALSE;
257
writable = gm_conf_is_key_writable (conf_key);
259
hbox = gtk_hbox_new (FALSE, 0);
261
label = gtk_label_new_with_mnemonic (down_label_txt);
263
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
265
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
268
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
269
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
271
adj = (GtkAdjustment *)
272
gtk_adjustment_new (gm_conf_get_int (conf_key),
276
hscale = gtk_hscale_new (adj);
277
gtk_scale_set_draw_value (GTK_SCALE (hscale), FALSE);
278
gtk_widget_set_size_request (GTK_WIDGET (hscale), 150, -1);
279
gtk_range_set_update_policy (GTK_RANGE (hscale),
282
gtk_widget_set_sensitive (GTK_WIDGET (hscale), FALSE);
284
gtk_box_pack_start (GTK_BOX (hbox), hscale, FALSE, FALSE,
288
label = gtk_label_new_with_mnemonic (up_label_txt);
290
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
292
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
295
gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, row, row+1,
296
(GtkAttachOptions) (GTK_FILL),
297
(GtkAttachOptions) (GTK_FILL),
300
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
302
gtk_tooltips_set_tip (gpw->tips, hscale, tooltip, NULL);
304
g_signal_connect (G_OBJECT (adj), "value-changed",
305
G_CALLBACK (adjustment_changed),
306
(gpointer) conf_key);
308
gm_conf_notifier_add (conf_key, adjustment_changed_nt,
311
gtk_widget_show_all (table);
318
gnome_prefs_spin_new (GtkWidget *table,
329
GnomePrefsWindow *gpw = NULL;
330
GtkWidget *hbox = NULL;
331
GtkAdjustment *adj = NULL;
332
GtkWidget *label = NULL;
333
GtkWidget *spin_button = NULL;
335
gboolean writable = FALSE;
337
writable = gm_conf_is_key_writable (conf_key);
341
hbox = gtk_hbox_new (FALSE, 0);
343
label = gtk_label_new_with_mnemonic (label_txt);
345
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
348
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
351
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
352
(GtkAttachOptions) (GTK_FILL),
353
(GtkAttachOptions) (GTK_FILL),
356
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
357
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
359
adj = (GtkAdjustment *)
360
gtk_adjustment_new (gm_conf_get_int (conf_key),
364
spin_button = gtk_spin_button_new (adj, 1.0, 0);
366
gtk_widget_set_sensitive (GTK_WIDGET (spin_button), FALSE);
369
gtk_box_pack_start (GTK_BOX (hbox), spin_button, FALSE, FALSE,
372
gtk_table_attach (GTK_TABLE (table), spin_button, 1, 2, row, row+1,
373
(GtkAttachOptions) (GTK_FILL),
374
(GtkAttachOptions) (GTK_FILL),
377
if (box && label_txt2) {
379
label = gtk_label_new_with_mnemonic (label_txt2);
381
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
383
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
389
gtk_table_attach (GTK_TABLE (table), hbox,
390
0, GTK_TABLE (table)->ncols, row, row+1,
391
(GtkAttachOptions) (GTK_FILL),
392
(GtkAttachOptions) (GTK_FILL),
396
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
398
gtk_tooltips_set_tip (gpw->tips, spin_button, tooltip, NULL);
400
g_signal_connect (G_OBJECT (adj), "value-changed",
401
G_CALLBACK (adjustment_changed),
402
(gpointer) conf_key);
404
gm_conf_notifier_add (conf_key, adjustment_changed_nt,
407
gtk_widget_show_all (table);
414
gnome_prefs_range_new (GtkWidget *table,
420
gchar *spin1_conf_key,
421
gchar *spin2_conf_key,
422
gchar *spin1_tooltip,
423
gchar *spin2_tooltip,
431
GnomePrefsWindow *gpw = NULL;
432
int val1 = 0, val2 = 0;
433
gboolean writable = FALSE;
434
GtkWidget *hbox = NULL;
435
GtkAdjustment *adj1 = NULL;
436
GtkWidget *spin_button1 = NULL;
437
GtkWidget *spin_button2 = NULL;
438
GtkAdjustment *adj2 = NULL;
439
GtkWidget *label = NULL;
442
(gm_conf_is_key_writable (spin1_conf_key)
444
gm_conf_is_key_writable (spin2_conf_key));
446
hbox = gtk_hbox_new (FALSE, 0);
447
label = gtk_label_new_with_mnemonic (label1_txt);
449
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
450
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
453
val1 = gm_conf_get_int (spin1_conf_key);
454
adj1 = (GtkAdjustment *)
455
gtk_adjustment_new (val1, spin1_min, spin1_max, spins_step, 2.0, 1.0);
456
spin_button1 = gtk_spin_button_new (adj1, 1.0, 0);
458
gtk_widget_set_sensitive (GTK_WIDGET (spin_button1), FALSE);
459
gtk_box_pack_start (GTK_BOX (hbox), spin_button1, FALSE, FALSE,
462
label = gtk_label_new_with_mnemonic (label2_txt);
464
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
465
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
468
val2 = gm_conf_get_int (spin2_conf_key);
469
adj2 = (GtkAdjustment *)
470
gtk_adjustment_new (val2, spin2_min, spin2_max, spins_step, 2.0, 1.0);
471
spin_button2 = gtk_spin_button_new (adj2, 1.0, 0);
473
gtk_widget_set_sensitive (GTK_WIDGET (spin_button2), FALSE);
474
gtk_box_pack_start (GTK_BOX (hbox), spin_button2, FALSE, FALSE,
477
label = gtk_label_new_with_mnemonic (label3_txt);
479
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
480
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE,
483
gtk_table_attach (GTK_TABLE (table), hbox, 0, 1, row, row+1,
484
(GtkAttachOptions) (NULL),
485
(GtkAttachOptions) (NULL),
488
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
489
if (gpw && spin1_tooltip && spin2_tooltip) {
490
gtk_tooltips_set_tip (gpw->tips, spin_button1, spin1_tooltip, NULL);
491
gtk_tooltips_set_tip (gpw->tips, spin_button2, spin2_tooltip, NULL);
495
g_signal_connect (G_OBJECT (adj1), "value-changed",
496
G_CALLBACK (adjustment_changed),
497
(gpointer) spin1_conf_key);
498
gm_conf_notifier_add (spin1_conf_key, adjustment_changed_nt,
501
g_signal_connect (G_OBJECT (adj2), "value-changed",
502
G_CALLBACK (adjustment_changed),
503
(gpointer) spin2_conf_key);
504
gm_conf_notifier_add (spin2_conf_key, adjustment_changed_nt,
508
*spin1 = spin_button1;
511
*spin2 = spin_button2;
516
gnome_prefs_int_option_menu_new (GtkWidget *table,
523
GnomePrefsWindow *gpw = NULL;
524
GtkWidget *item = NULL;
525
GtkWidget *label = NULL;
526
GtkWidget *option_menu = NULL;
527
GtkWidget *menu = NULL;
530
gboolean writable = FALSE;
532
writable = gm_conf_is_key_writable (conf_key);
534
label = gtk_label_new_with_mnemonic (label_txt);
536
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
538
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
539
(GtkAttachOptions) (GTK_FILL),
540
(GtkAttachOptions) (GTK_FILL),
543
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
544
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
546
menu = gtk_menu_new ();
547
option_menu = gtk_option_menu_new ();
549
gtk_widget_set_sensitive (GTK_WIDGET (option_menu), FALSE);
551
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
553
while (options [cpt]) {
555
item = gtk_menu_item_new_with_label (options [cpt]);
556
gtk_widget_show (item);
557
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
561
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
562
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu),
563
gm_conf_get_int (conf_key));
565
gtk_table_attach (GTK_TABLE (table), option_menu, 1, 2, row, row+1,
566
(GtkAttachOptions) (GTK_FILL),
567
(GtkAttachOptions) (GTK_FILL),
570
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
572
gtk_tooltips_set_tip (gpw->tips, option_menu, tooltip, NULL);
575
g_signal_connect (G_OBJECT (GTK_OPTION_MENU (option_menu)->menu),
576
"deactivate", G_CALLBACK (int_option_menu_changed),
577
(gpointer) conf_key);
578
gm_conf_notifier_add (conf_key, int_option_menu_changed_nt,
579
(gpointer) option_menu);
581
gtk_widget_show_all (table);
588
gnome_prefs_string_option_menu_new (GtkWidget *table,
595
GnomePrefsWindow *gpw = NULL;
597
GtkWidget *item = NULL;
598
GtkWidget *label = NULL;
599
GtkWidget *option_menu = NULL;
600
GtkWidget *menu = NULL;
601
gchar *conf_string = NULL;
604
gboolean writable = FALSE;
606
writable = gm_conf_is_key_writable (conf_key);
608
label = gtk_label_new (label_txt);
610
gtk_widget_set_sensitive (GTK_WIDGET (label), FALSE);
612
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
613
(GtkAttachOptions) (GTK_FILL),
614
(GtkAttachOptions) (GTK_FILL),
617
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
618
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
621
menu = gtk_menu_new ();
622
option_menu = gtk_option_menu_new ();
624
gtk_widget_set_sensitive (GTK_WIDGET (option_menu), FALSE);
625
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
627
conf_string = gm_conf_get_string (conf_key);
629
while (options [cpt]) {
631
if (conf_string != NULL)
632
if (!strcmp (conf_string, options [cpt]))
635
item = gtk_menu_item_new_with_label (options [cpt]);
636
gtk_widget_show (item);
637
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
644
gm_conf_set_string (conf_key, options [0]);
648
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
649
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu),
653
gtk_table_attach (GTK_TABLE (table), option_menu, 1, 2, row, row+1,
654
(GtkAttachOptions) (GTK_FILL),
655
(GtkAttachOptions) (GTK_FILL),
658
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (table), "gpw");
660
gtk_tooltips_set_tip (gpw->tips, option_menu, tooltip, NULL);
662
g_signal_connect (G_OBJECT (GTK_OPTION_MENU (option_menu)->menu),
663
"deactivate", G_CALLBACK (string_option_menu_changed),
664
(gpointer) conf_key);
665
gm_conf_notifier_add (conf_key, string_option_menu_changed_nt,
666
(gpointer) option_menu);
668
g_free (conf_string);
670
gtk_widget_show_all (table);
677
gnome_prefs_string_option_menu_update (GtkWidget *option_menu,
681
GtkWidget *menu = NULL;
682
GtkWidget *item = NULL;
684
gchar *conf_string = NULL;
689
if (!options || !conf_key)
692
conf_string = gm_conf_get_string (conf_key);
694
gtk_option_menu_remove_menu (GTK_OPTION_MENU (option_menu));
695
menu = gtk_menu_new ();
698
while (options [cpt]) {
700
if (conf_string && !strcmp (options [cpt], conf_string))
703
item = gtk_menu_item_new_with_label (options [cpt]);
704
gtk_widget_show (item);
705
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
716
gm_conf_set_string (conf_key, options [0]);
719
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
720
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), history);
723
g_signal_connect (G_OBJECT (GTK_OPTION_MENU (option_menu)->menu),
724
"deactivate", G_CALLBACK (string_option_menu_changed),
725
(gpointer) conf_key);
727
g_free (conf_string);
732
gnome_prefs_subsection_new (GtkWidget *window,
733
GtkWidget *container,
738
GnomePrefsWindow *gpw = NULL;
740
GtkWidget *hbox = NULL;
741
GtkWidget *frame = NULL;
742
GtkWidget *table = NULL;
743
GtkWidget *label = NULL;
745
PangoAttrList *attrs = NULL;
746
PangoAttribute *attr = NULL;
749
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (window), "gpw");
751
hbox = gtk_hbox_new (FALSE, 6);
753
frame = gtk_frame_new (frame_name);
754
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
756
attrs = pango_attr_list_new ();
757
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
758
attr->start_index = 0;
759
attr->end_index = -1;
760
pango_attr_list_insert (attrs, attr);
762
label = gtk_frame_get_label_widget (GTK_FRAME (frame));
763
gtk_label_set_attributes (GTK_LABEL (label), attrs);
764
pango_attr_list_unref (attrs);
766
gtk_box_pack_start (GTK_BOX (container), frame,
768
table = gtk_table_new (rows, cols, FALSE);
770
gtk_container_add (GTK_CONTAINER (frame), hbox);
772
gtk_container_set_border_width (GTK_CONTAINER (hbox), 3);
773
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
775
label = gtk_label_new (" ");
776
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
777
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
779
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
780
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
783
g_object_set_data (G_OBJECT (table), "gpw", gpw);
785
gtk_widget_show_all (table);
792
gnome_prefs_window_new (gchar *logo_name)
794
GnomePrefsWindow *gpw = NULL;
796
GtkTreeSelection *selection = NULL;
797
GtkCellRenderer *cell = NULL;
798
GtkTreeStore *model = NULL;
799
GtkTreeViewColumn *column = NULL;
801
GtkWidget *window = NULL;
802
GtkWidget *event_box = NULL;
803
GtkWidget *hbox = NULL;
804
GtkWidget *vbox = NULL;
805
GtkWidget *frame = NULL;
806
GtkWidget *pixmap = NULL;
807
GtkWidget *hsep = NULL;
811
PangoAttrList *attrs = NULL;
812
PangoAttribute *attr = NULL;
814
/* Box inside the prefs window */
815
GtkWidget *dialog_vbox = NULL;
817
/* Build the window */
818
window = gtk_dialog_new ();
820
gpw = (GnomePrefsWindow *) g_malloc (sizeof (GnomePrefsWindow));
823
g_object_set_data_full (G_OBJECT (window), "gpw", (gpointer) gpw, g_free);
825
gtk_dialog_add_button (GTK_DIALOG (window), GTK_STOCK_CLOSE, 0);
829
gpw->notebook = gtk_notebook_new ();
830
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (gpw->notebook), FALSE);
831
gtk_notebook_set_show_border (GTK_NOTEBOOK (gpw->notebook), FALSE);
832
gtk_notebook_popup_enable (GTK_NOTEBOOK (gpw->notebook));
834
pixmap = gtk_image_new_from_file (logo_name);
836
event_box = gtk_event_box_new ();
837
gtk_container_add (GTK_CONTAINER (event_box),
838
GTK_WIDGET (pixmap));
840
gdk_color_white (gdk_colormap_get_system (), &cwhite);
841
gtk_widget_modify_bg (GTK_WIDGET (event_box),
842
GTK_STATE_NORMAL, &cwhite);
844
gtk_notebook_prepend_page (GTK_NOTEBOOK (gpw->notebook), event_box, NULL);
848
dialog_vbox = GTK_DIALOG (window)->vbox;
850
hbox = gtk_hbox_new (FALSE, 6);
851
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
852
gtk_container_add (GTK_CONTAINER (dialog_vbox), hbox);
856
gpw->tips = gtk_tooltips_new ();
859
/* Build the TreeView on the left */
860
frame = gtk_frame_new (NULL);
861
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
862
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
863
model = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
864
gpw->sections_tree_view = gtk_tree_view_new ();
865
gtk_tree_view_set_model (GTK_TREE_VIEW (gpw->sections_tree_view),
866
GTK_TREE_MODEL (model));
868
gtk_tree_view_get_selection (GTK_TREE_VIEW (gpw->sections_tree_view));
869
gtk_container_add (GTK_CONTAINER (frame), gpw->sections_tree_view);
870
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (gpw->sections_tree_view),
872
cell = gtk_cell_renderer_text_new ();
874
column = gtk_tree_view_column_new_with_attributes (NULL, cell, "text", 0,
877
gtk_tree_view_append_column (GTK_TREE_VIEW (gpw->sections_tree_view),
878
GTK_TREE_VIEW_COLUMN (column));
879
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
880
GTK_SELECTION_BROWSE);
883
/* Some design stuff to put the notebook pages in it */
884
frame = gtk_frame_new (NULL);
885
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
886
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
887
gtk_widget_show (frame);
889
vbox = gtk_vbox_new (FALSE, 0);
890
gtk_container_add (GTK_CONTAINER (frame), vbox);
891
gtk_widget_show (vbox);
894
gpw->section_label = gtk_label_new (NULL);
895
frame = gtk_frame_new (NULL);
896
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
897
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
898
gtk_misc_set_alignment (GTK_MISC (gpw->section_label), 0.0, 0.5);
899
gtk_container_add (GTK_CONTAINER (frame), gpw->section_label);
900
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
901
attrs = pango_attr_list_new ();
902
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
903
attr->start_index = 0;
904
attr->end_index = G_MAXUINT;
905
pango_attr_list_insert (attrs, attr);
906
attr = pango_attr_weight_new (PANGO_WEIGHT_HEAVY);
907
attr->start_index = 0;
908
attr->end_index = G_MAXUINT;
909
pango_attr_list_insert (attrs, attr);
910
gtk_label_set_attributes (GTK_LABEL (gpw->section_label), attrs);
911
pango_attr_list_unref (attrs);
912
gtk_widget_show (gpw->section_label);
914
hsep = gtk_hseparator_new ();
915
gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, FALSE, 0);
916
gtk_box_pack_start (GTK_BOX (vbox), gpw->notebook, TRUE, TRUE, 0);
918
gtk_widget_show_all (GTK_WIDGET (dialog_vbox));
919
gtk_widget_show_all (GTK_WIDGET (gpw->sections_tree_view));
921
g_signal_connect (selection, "changed",
922
G_CALLBACK (tree_selection_changed_cb),
931
gnome_prefs_window_section_new (GtkWidget *window,
934
GnomePrefsWindow *gpw = NULL;
935
GtkTreeModel *model = NULL;
941
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (window), "gpw");
943
if (!gpw || !section_name)
946
model = gtk_tree_view_get_model (GTK_TREE_VIEW (gpw->sections_tree_view));
947
gtk_tree_store_append (GTK_TREE_STORE (model), &gpw->iter, NULL);
948
gtk_tree_store_set (GTK_TREE_STORE (model), &gpw->iter, 0,
949
section_name, 1, 0, -1);
950
gtk_tree_view_expand_all (GTK_TREE_VIEW (gpw->sections_tree_view));
955
gnome_prefs_window_subsection_new (GtkWidget *window,
958
GnomePrefsWindow *gpw = NULL;
959
GtkWidget *container = NULL;
960
GtkTreeModel *model = NULL;
961
GtkTreeIter child_iter;
966
gpw = (GnomePrefsWindow *) g_object_get_data (G_OBJECT (window), "gpw");
968
if (!gpw || !section_name)
971
container = gtk_vbox_new (FALSE, 4);
972
model = gtk_tree_view_get_model (GTK_TREE_VIEW (gpw->sections_tree_view));
973
gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &gpw->iter);
974
gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter, 0, section_name,
975
1, gpw->last_page, -1);
976
gtk_tree_view_expand_all (GTK_TREE_VIEW (gpw->sections_tree_view));
980
gtk_notebook_append_page (GTK_NOTEBOOK (gpw->notebook),
983
gtk_widget_show_all (container);