Mercurial > pidgin
diff src/dialogs.c @ 2379:cacaf7ace3a5
[gaim-migrate @ 2392]
reorganization of some functions.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 28 Sep 2001 01:25:02 +0000 |
| parents | 466b29d35b85 |
| children | 569ae9f2bb89 |
line wrap: on
line diff
--- a/src/dialogs.c Thu Sep 27 23:58:48 2001 +0000 +++ b/src/dialogs.c Fri Sep 28 01:25:02 2001 +0000 @@ -68,6 +68,8 @@ #include "pixmaps/wink.xpm" #include "pixmaps/yell.xpm" +#include "pixmaps/aimicon.xpm" + #include "pixmaps/aol_icon.xpm" #include "pixmaps/free_icon.xpm" #include "pixmaps/dt_icon.xpm" @@ -4085,3 +4087,128 @@ } #endif /* USE_PERL */ + +static GdkPixmap *icon_pm = NULL; +static GdkBitmap *icon_bm = NULL; + +void aol_icon(GdkWindow *w) +{ +#ifndef _WIN32 + if (icon_pm == NULL) { + icon_pm = gdk_pixmap_create_from_xpm_d(w, &icon_bm, NULL, (gchar **)aimicon_xpm); + } + gdk_window_set_icon(w, NULL, icon_pm, icon_bm); + if (mainwindow) + gdk_window_set_group(w, mainwindow->window); +#endif +} + +GtkWidget *picture_button(GtkWidget *window, char *text, char **xpm) +{ + GtkWidget *button; + GtkWidget *button_box, *button_box_2, *button_box_3; + GtkWidget *label; + GdkBitmap *mask; + GdkPixmap *pm; + GtkWidget *pixmap; + + button = gtk_button_new(); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + + button_box = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(button), button_box); + + button_box_2 = gtk_hbox_new(FALSE, 0); + button_box_3 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(button_box), button_box_2, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(button_box), button_box_3, TRUE, TRUE, 0); + pm = gdk_pixmap_create_from_xpm_d(window->window, &mask, NULL, xpm); + pixmap = gtk_pixmap_new(pm, mask); + gtk_box_pack_end(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0); + + if (text) { + label = gtk_label_new(text); + gtk_box_pack_start(GTK_BOX(button_box_3), label, FALSE, FALSE, 2); + gtk_widget_show(label); + } + + gtk_widget_show(pixmap); + gtk_widget_show(button_box_2); + gtk_widget_show(button_box_3); + gtk_widget_show(button_box); + +/* this causes clipping on lots of buttons with long text */ +/* gtk_widget_set_usize(button, 75, 30);*/ + gtk_widget_show(button); + gdk_pixmap_unref(pm); + gdk_bitmap_unref(mask); + + return button; +} + +static GtkTooltips *button_tips = NULL; +GtkWidget *picture_button2(GtkWidget *window, char *text, char **xpm, short dispstyle) +{ + GtkWidget *button; + GtkWidget *button_box, *button_box_2; + GdkBitmap *mask; + GdkPixmap *pm; + GtkWidget *pixmap; + GtkWidget *label; + + if (!button_tips) + button_tips = gtk_tooltips_new(); + button = gtk_button_new(); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + + button_box = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(button), button_box); + + button_box_2 = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(button_box), button_box_2, TRUE, TRUE, 0); + gtk_widget_show(button_box_2); + gtk_widget_show(button_box); + if (dispstyle == 2 || dispstyle == 0) { + pm = gdk_pixmap_create_from_xpm_d(window->window, &mask, NULL, xpm); + pixmap = gtk_pixmap_new(pm, mask); + gtk_box_pack_start(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0); + + gtk_widget_show(pixmap); + + gdk_pixmap_unref(pm); + gdk_bitmap_unref(mask); + } + + if (dispstyle == 2 || dispstyle == 1) { + label = gtk_label_new(text); + gtk_widget_show(label); + gtk_box_pack_end(GTK_BOX(button_box_2), label, FALSE, FALSE, 0); + } + + gtk_tooltips_set_tip(button_tips, button, text, "Gaim"); + gtk_widget_show(button); + return button; +} + +int file_is_dir(const char *path, GtkWidget *w) +{ + struct stat st; + char *name; + + if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { + /* append a / if needed */ + if (path[strlen(path) - 1] != '/') { + name = g_strconcat(path, "/", NULL); + } else { + name = g_strdup(path); + } + gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name); + g_free(name); + return 1; + } + + return 0; +}
