]>
Commit | Line | Data |
---|---|---|
b781ab22 | 1 | --- control-center-1.0.5/capplets/background-properties/property-background.c.limitedbgs Fri Apr 2 17:16:33 1999 |
2 | +++ control-center-1.0.5/capplets/background-properties/property-background.c Mon Apr 5 17:09:53 1999 | |
3 | @@ -19,6 +19,8 @@ | |
4 | #include <gnome.h> | |
5 | #include "imlib-misc.h" | |
6 | ||
7 | +#define MAX_NUMBER_OF_WP 8 | |
8 | + | |
9 | static GtkWidget *capplet=NULL; | |
10 | ||
11 | static GtkWidget *preview; | |
12 | @@ -31,6 +33,7 @@ | |
13 | static gint wpNum; | |
14 | static gint fillPreview = TRUE; | |
15 | static gint ignoreChanges = TRUE; | |
16 | +static GList *wplist = NULL; | |
17 | ||
18 | enum { | |
19 | WALLPAPER_TILED, | |
20 | @@ -758,26 +761,17 @@ | |
21 | /* hack */ | |
22 | if (!ignoreChanges && found < 0) { | |
23 | ||
24 | - cf = gtk_menu_item_new_with_label (str); | |
25 | - gtk_signal_connect (GTK_OBJECT (cf), | |
26 | - "activate", | |
27 | - (GtkSignalFunc) browse_activated, str); | |
28 | - gtk_menu_append (GTK_MENU (wpMenu), cf); | |
29 | - gtk_widget_show (cf); | |
30 | - wpNum++; | |
31 | - | |
32 | - gs = g_string_new ("/Background/Default/wallpaper"); | |
33 | - snprintf (num, sizeof(num), "%d", wpNum); | |
34 | - g_string_append (gs, num); | |
35 | - gnome_config_set_string (gs->str, str); | |
36 | - g_string_free (gs, TRUE); | |
37 | - | |
38 | - gnome_config_set_int ("/Background/Default/wallpapers", wpNum); | |
39 | - gnome_config_set_string ("/Background/Default/wallpapers_dir", | |
40 | - str); | |
41 | - | |
42 | - found = wpNum; | |
43 | - gnome_config_sync (); | |
44 | + cf = gtk_menu_item_new_with_label (str); | |
45 | + gtk_signal_connect (GTK_OBJECT (cf), | |
46 | + "activate", | |
47 | + (GtkSignalFunc) browse_activated, str); | |
48 | + gtk_menu_append (GTK_MENU (wpMenu), cf); | |
49 | + gtk_widget_show (cf); | |
50 | + wpNum++; | |
51 | + | |
52 | + wplist = g_list_prepend (wplist, g_strdup (str)); | |
53 | + found = wpNum; | |
54 | + gnome_config_sync (); | |
55 | } | |
56 | ||
57 | if (curState.wpFileName) | |
58 | @@ -785,7 +779,7 @@ | |
59 | curState.wpFileName = g_strdup(str); | |
60 | curState.bgType = BACKGROUND_WALLPAPER; | |
61 | ||
62 | - gtk_option_menu_set_history (GTK_OPTION_MENU (wpOMenu), found); | |
63 | + gtk_option_menu_set_history (GTK_OPTION_MENU (wpOMenu), found - 1); | |
64 | ||
65 | fill_monitor (!ignoreChanges, &curState); | |
66 | ||
67 | @@ -960,31 +954,31 @@ | |
68 | (GtkSignalFunc) browse_activated, NULL); | |
69 | ||
70 | wpNum = gnome_config_get_int ("/Background/Default/wallpapers=0"); | |
71 | - | |
72 | for (i = 0; i<wpNum; i++) { | |
73 | - | |
74 | - /* printf ("wallpaper%d", i); */ | |
75 | - wpName = g_string_new ("/Background/Default/wallpaper"); | |
76 | - snprintf (num, sizeof(num),"%d", i+1); | |
77 | - g_string_append (wpName, num); | |
78 | - g_string_append (wpName, "=???"); | |
79 | - | |
80 | - wpName1 = gnome_config_get_string (wpName->str); | |
81 | - /* printf (": %s\n", wpName1); */ | |
82 | - if (wpName1) { | |
83 | - if (state->wpFileName) | |
84 | - if (!strcmp (wpName1, state->wpFileName)) | |
85 | - selectedWp = i + 1; | |
86 | - | |
87 | - none = gtk_menu_item_new_with_label (wpName1); | |
88 | - gtk_menu_append (GTK_MENU (wpMenu), none); | |
89 | - gtk_signal_connect (GTK_OBJECT (none), | |
90 | - "activate", | |
91 | - (GtkSignalFunc) browse_activated, wpName1); | |
92 | - gtk_widget_show (none); | |
93 | - } | |
94 | - | |
95 | - g_string_free (wpName, TRUE); | |
96 | + wpName = g_string_new ("/Background/Default/wallpaper"); | |
97 | + snprintf (num, sizeof(num),"%d", i); | |
98 | + g_string_append (wpName, num); | |
99 | + if (i > MAX_NUMBER_OF_WP) { | |
100 | + /* We want to blow away the old ones. */ | |
101 | + gnome_config_clean_key (wpName->str); | |
102 | + } else { | |
103 | + /* printf ("wallpaper%d", i); */ | |
104 | + | |
105 | + wpName1 = gnome_config_get_string (wpName->str); | |
106 | + if (wpName1) { | |
107 | + if (state->wpFileName) | |
108 | + if (!strcmp (wpName1, state->wpFileName)) | |
109 | + selectedWp = i + 1; | |
110 | + none = gtk_menu_item_new_with_label (wpName1); | |
111 | + wplist = g_list_prepend (wplist, g_strdup (wpName1)); | |
112 | + gtk_menu_append (GTK_MENU (wpMenu), none); | |
113 | + gtk_signal_connect (GTK_OBJECT (none), | |
114 | + "activate", | |
115 | + (GtkSignalFunc) browse_activated, wpName1); | |
116 | + gtk_widget_show (none); | |
117 | + } | |
118 | + } | |
119 | + g_string_free (wpName, TRUE); | |
120 | } | |
121 | ||
122 | wpOMenu = gtk_option_menu_new (); | |
123 | @@ -1137,7 +1131,7 @@ | |
124 | background_try(GtkWidget *widget, struct bgState *state) | |
125 | { | |
126 | ||
127 | -printState(state); | |
128 | +/*printState(state);*/ | |
129 | background_apply(state); | |
130 | } | |
131 | ||
132 | @@ -1166,7 +1160,8 @@ | |
133 | background_write (struct bgState *state) | |
134 | { | |
135 | char buffer [60]; | |
136 | - | |
137 | + GList *list; | |
138 | + gint i = 0; | |
139 | ||
140 | snprintf (buffer, sizeof(buffer), "#%02x%02x%02x", | |
141 | state->bgColor1.red >> 8, | |
142 | @@ -1189,11 +1184,17 @@ | |
143 | gnome_config_set_string ("/Background/Default/wallpaper", | |
144 | (state->bgType == BACKGROUND_SIMPLE) ? "none" : state->wpFileName); | |
145 | gnome_config_set_int ("/Background/Default/wallpaperAlign", state->wpType); | |
146 | + for (list = wplist; list; list = list->next) { | |
147 | +/* if (i > MAX_NUMBER_OF_WP) | |
148 | + break;*/ | |
149 | + snprintf (buffer, sizeof(buffer), "/Background/Default/wallpaper%d", i); | |
150 | + gnome_config_set_string (buffer, (gchar *) list->data); | |
151 | + i++; | |
152 | + } | |
153 | + gnome_config_set_int ("/Background/Default/wallpapers", i - 1); | |
154 | ||
155 | gnome_config_sync (); | |
156 | -#if 0 | |
157 | - background_apply(state); | |
158 | -#endif | |
159 | + | |
160 | } | |
161 | ||
162 | void |