comparison src/prefs.c @ 4328:2cbcaf41cfee

[gaim-migrate @ 4584] someone else made a mess. I won't name names. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 17 Jan 2003 20:16:39 +0000
parents eb63f9960d07
children 92ee505756d6
comparison
equal deleted inserted replaced
4327:da5e1b57adb0 4328:2cbcaf41cfee
217 GtkTreePath *theme_refresh_theme_list() 217 GtkTreePath *theme_refresh_theme_list()
218 { 218 {
219 GdkPixbuf *pixbuf; 219 GdkPixbuf *pixbuf;
220 GSList *themes; 220 GSList *themes;
221 GtkTreeIter iter; 221 GtkTreeIter iter;
222 GtkTreePath *path; 222 GtkTreePath *path = NULL;
223 int ind = 0; 223 int ind = 0;
224 224
225 225
226 smiley_theme_probe(); 226 smiley_theme_probe();
227 227
228 if (!smiley_themes) 228 if (!smiley_themes)
229 return; 229 return NULL;
230 230
231 themes = smiley_themes; 231 themes = smiley_themes;
232 232
233 gtk_list_store_clear(smiley_theme_store); 233 gtk_list_store_clear(smiley_theme_store);
234 234
237 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" 237 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n"
238 "<span size='smaller' foreground='gray'>%s</span>", 238 "<span size='smaller' foreground='gray'>%s</span>",
239 theme->name, theme->author, theme->desc);; 239 theme->name, theme->author, theme->desc);;
240 gtk_list_store_append (smiley_theme_store, &iter); 240 gtk_list_store_append (smiley_theme_store, &iter);
241 pixbuf = gdk_pixbuf_new_from_file(theme->icon, NULL); 241 pixbuf = gdk_pixbuf_new_from_file(theme->icon, NULL);
242 242
243 gtk_list_store_set(smiley_theme_store, &iter, 243 gtk_list_store_set(smiley_theme_store, &iter,
244 0, pixbuf, 244 0, pixbuf,
245 1, description, 245 1, description,
246 2, theme->path, 246 2, theme->path,
247 -1); 247 -1);
305 305
306 unlink(path); 306 unlink(path);
307 g_free(path); 307 g_free(path);
308 } 308 }
309 309
310 gint theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, 310 void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd,
311 guint info, guint t, gpointer data) { 311 guint info, guint t, gpointer data) {
312 GList *dcl = dc->targets;
313 gchar *name = sd->data; 312 gchar *name = sd->data;
314 313
315 if ((sd->length >= 0) && (sd->format == 8)) { 314 if ((sd->length >= 0) && (sd->format == 8)) {
316 /* Well, it looks like the drag event was cool. 315 /* Well, it looks like the drag event was cool.
317 * Let's do something with it */ 316 * Let's do something with it */
322 theme_install_theme(name + 7, NULL); 321 theme_install_theme(name + 7, NULL);
323 } else if (!g_strncasecmp(name, "http://", 7)) { 322 } else if (!g_strncasecmp(name, "http://", 7)) {
324 /* Oo, a web drag and drop. This is where things 323 /* Oo, a web drag and drop. This is where things
325 * will start to get interesting */ 324 * will start to get interesting */
326 gchar *tail; 325 gchar *tail;
327 326
328 if ((tail = strrchr(name, '.')) == NULL) 327 if ((tail = strrchr(name, '.')) == NULL)
329 return; 328 return;
330 329
331 /* We'll check this just to make sure. This also lets us do something different on 330 /* We'll check this just to make sure. This also lets us do something different on
332 * other platforms, if need be */ 331 * other platforms, if need be */
343 } 342 }
344 343
345 GtkWidget *theme_page() { 344 GtkWidget *theme_page() {
346 GtkWidget *ret; 345 GtkWidget *ret;
347 GtkWidget *sw; 346 GtkWidget *sw;
348 GSList *themes;
349 GtkTreeIter iter;
350 GtkWidget *view; 347 GtkWidget *view;
351 GtkCellRenderer *rend; 348 GtkCellRenderer *rend;
352 GtkTreeViewColumn *col; 349 GtkTreeViewColumn *col;
353 GtkTreeSelection *sel; 350 GtkTreeSelection *sel;
354 GtkTreePath *path = NULL; 351 GtkTreePath *path = NULL;
355 GdkPixbuf *pixbuf;
356 int ind =0;
357 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 1, 0},{"STRING", 2, 0}}; 352 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 1, 0},{"STRING", 2, 0}};
358 353
359 ret = gtk_vbox_new(FALSE, 18); 354 ret = gtk_vbox_new(FALSE, 18);
360 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); 355 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
361 356
375 370
376 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store); 371 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store);
377 372
378 rend = gtk_cell_renderer_pixbuf_new(); 373 rend = gtk_cell_renderer_pixbuf_new();
379 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); 374 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
380 375
381 gtk_tree_selection_select_path(sel, path); 376 if(path) {
382 gtk_tree_path_free(path); 377 gtk_tree_selection_select_path(sel, path);
378 gtk_tree_path_free(path);
379 }
383 380
384 col = gtk_tree_view_column_new_with_attributes ("Icon", 381 col = gtk_tree_view_column_new_with_attributes ("Icon",
385 rend, 382 rend,
386 "pixbuf", 0, 383 "pixbuf", 0,
387 NULL); 384 NULL);