# HG changeset patch # User Rob Flynn # Date 1034386244 0 # Node ID f09193608fd3636c339d02487ad66a831e3de9c1 # Parent 1e8c10125558d4f4a9792e8b80b0c48b83215059 [gaim-migrate @ 3773] Really, I think this is a lot prettier. committer: Tailor Script diff -r 1e8c10125558 -r f09193608fd3 pixmaps/Makefile.am --- a/pixmaps/Makefile.am Fri Oct 11 21:25:48 2002 +0000 +++ b/pixmaps/Makefile.am Sat Oct 12 01:30:44 2002 +0000 @@ -1,5 +1,6 @@ SUBDIRS = protocols EXTRA_DIST = about_small.xpm \ + accounts.png \ add.xpm \ add_small.xpm \ angel.xpm \ @@ -47,6 +48,7 @@ kiss.xpm \ link.xpm \ login_icon.xpm \ + logo.png \ logo.xpm \ logout_icon.xpm \ logout_menu.xpm \ @@ -64,6 +66,7 @@ panic.xpm \ plugins_small.xpm \ pounce_small.xpm \ + preferences.png \ prefs_small.xpm \ refresh.xpm \ sad.xpm \ @@ -72,6 +75,7 @@ scream.xpm \ search_small.xpm \ send_small.xpm \ + signon.png \ small.xpm \ smile.xpm \ smile8.xpm \ @@ -99,7 +103,7 @@ gaimbuttonpixdir = $(datadir)/pixmaps/gaim/buttons -gaimbuttonpix_DATA = edit.png +gaimbuttonpix_DATA = edit.png accounts.png signon.png preferences.png gaimdialogpixdir = $(datadir)/pixmaps/gaim/dialogs gaimdialogpix_DATA = gaim_error.png gaim_info.png gaim_question.png gaim_warning.png diff -r 1e8c10125558 -r f09193608fd3 pixmaps/accounts.png Binary file pixmaps/accounts.png has changed diff -r 1e8c10125558 -r f09193608fd3 pixmaps/logo.png Binary file pixmaps/logo.png has changed diff -r 1e8c10125558 -r f09193608fd3 pixmaps/preferences.png Binary file pixmaps/preferences.png has changed diff -r 1e8c10125558 -r f09193608fd3 pixmaps/signon.png Binary file pixmaps/signon.png has changed diff -r 1e8c10125558 -r f09193608fd3 src/aim.c --- a/src/aim.c Fri Oct 11 21:25:48 2002 +0000 +++ b/src/aim.c Sat Oct 12 01:30:44 2002 +0000 @@ -224,62 +224,49 @@ return tmp; } - void show_login() { - GtkWidget *signon_all; - GtkWidget *options; - GtkWidget *plugs; -#ifndef NO_MULTI - GtkWidget *accts; -#endif - GtkWidget *signon; - GtkWidget *cancel; - GtkWidget *reg; - GtkWidget *bbox; + GdkPixbuf *icon; + GtkWidget *image; + GtkWidget *vbox; + GtkWidget *button; GtkWidget *hbox; - GtkWidget *sbox; GtkWidget *label; - GtkWidget *table; - - GtkWidget *pmw; - GdkPixmap *pm; - GtkStyle *style; - GdkBitmap *mask; - GList *tmp; + /* Do we already have a main window opened? If so, bring it back, baby... ribs... yeah */ if (mainwindow) { - gtk_window_present(GTK_WINDOW(mainwindow)); - return; + gtk_window_present(GTK_WINDOW(mainwindow)); + return; } mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", "Gaim"); gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); - gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", - GTK_SIGNAL_FUNC(cancel_logon), mainwindow); gtk_window_set_title(GTK_WINDOW(mainwindow), _("Gaim - Login")); gtk_widget_realize(mainwindow); gdk_window_set_group(mainwindow->window, mainwindow->window); + gtk_container_set_border_width(GTK_CONTAINER(mainwindow), 5); + gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", + GTK_SIGNAL_FUNC(cancel_logon), mainwindow); - table = gtk_table_new(8, 2, FALSE); - gtk_container_add(GTK_CONTAINER(mainwindow), table); - gtk_widget_show(table); - style = gtk_widget_get_style(mainwindow); - pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, - &style->bg[GTK_STATE_NORMAL], (gchar **)gaim_logo_xpm); - pmw = gtk_pixmap_new(pm, mask); - gtk_table_attach(GTK_TABLE(table), pmw, 0, 2, 0, 1, 0, 0, 5, 5); - gtk_widget_show(pmw); - gdk_pixmap_unref(pm); - gdk_bitmap_unref(mask); + icon = gaim_pixbuf(NULL, "gaim.png"); + if (icon) { + gtk_window_set_icon(GTK_WINDOW(mainwindow), icon); + gdk_pixbuf_unref(icon); + } - label = gtk_label_new(_("Screen Name: ")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, 0, 0, 5, 5); - gtk_widget_show(label); + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(mainwindow), vbox); + + image = gaim_pixmap(NULL, "logo.png"); + gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); + + label = gtk_label_new(_("Screen Name:")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); name = gtk_combo_new(); tmp = combo_user_names(); @@ -289,92 +276,47 @@ GTK_SIGNAL_FUNC(doenter), mainwindow); gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", GTK_SIGNAL_FUNC(combo_changed), name); - gtk_widget_set_usize(name, 100, 0); - gtk_table_attach(GTK_TABLE(table), name, 1, 2, 2, 3, 0, 0, 5, 5); - gtk_widget_show(name); + gtk_box_pack_start(GTK_BOX(vbox), name, FALSE, TRUE, 0); - label = gtk_label_new(_("Password: ")); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, 0, 0, 5, 5); - gtk_widget_show(label); + label = gtk_label_new(_("Password:")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); pass = gtk_entry_new(); - gtk_widget_set_usize(pass, 100, 0); gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); gtk_signal_connect(GTK_OBJECT(pass), "activate", GTK_SIGNAL_FUNC(doenter), mainwindow); - gtk_table_attach(GTK_TABLE(table), pass, 1, 2, 3, 4, 0, 0, 5, 5); - gtk_widget_show(pass); + gtk_box_pack_start(GTK_BOX(vbox), pass, FALSE, TRUE, 0); - sbox = gtk_vbox_new(TRUE, 5); - gtk_container_border_width(GTK_CONTAINER(sbox), 10); - gtk_table_attach(GTK_TABLE(table), sbox, 0, 2, 7, 8, 0, 0, 5, 5); - gtk_widget_show(sbox); - - bbox = gtk_hbox_new(TRUE, 10); - gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0); - gtk_widget_show(bbox); + /* Now for the button box */ + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5); - cancel = gtk_button_new_with_label(_("Quit")); -#ifndef NO_MULTI - accts = gtk_button_new_with_label(_("Accounts")); -#endif - signon = gtk_button_new_with_label(_("Signon")); - - if (misc_options & OPT_MISC_COOL_LOOK) { - gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); -#ifndef NO_MULTI - gtk_button_set_relief(GTK_BUTTON(accts), GTK_RELIEF_NONE); -#endif - gtk_button_set_relief(GTK_BUTTON(signon), GTK_RELIEF_NONE); - } - - gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(cancel_logon), mainwindow); -#ifndef NO_MULTI - gtk_signal_connect(GTK_OBJECT(accts), "clicked", GTK_SIGNAL_FUNC(account_editor), mainwindow); -#endif - gtk_signal_connect(GTK_OBJECT(signon), "clicked", GTK_SIGNAL_FUNC(dologin), mainwindow); + /* And now for the buttons */ + button = gaim_pixbuf_button("Accounts", "accounts.png", GAIM_BUTTON_VERTICAL); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(account_editor), mainwindow); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); -#ifndef NO_MULTI - gtk_box_pack_start(GTK_BOX(bbox), accts, TRUE, TRUE, 0); +#ifdef NO_MULTI + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); #endif - gtk_box_pack_start(GTK_BOX(bbox), signon, TRUE, TRUE, 0); - - gtk_widget_show(cancel); -#ifndef NO_MULTI - gtk_widget_show(accts); -#endif - gtk_widget_show(signon); - - hbox = gtk_hbox_new(TRUE, 10); - gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - reg = gtk_button_new_with_label(_("Auto-login")); - options = gtk_button_new_with_label(_("Options")); - plugs = gtk_button_new_with_label(_("About")); - if (misc_options & OPT_MISC_COOL_LOOK) { - gtk_button_set_relief(GTK_BUTTON(reg), GTK_RELIEF_NONE); - gtk_button_set_relief(GTK_BUTTON(options), GTK_RELIEF_NONE); - gtk_button_set_relief(GTK_BUTTON(plugs), GTK_RELIEF_NONE); - } + button = gaim_pixbuf_button("Settings", "preferences.png", GAIM_BUTTON_VERTICAL); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(show_prefs), mainwindow); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(reg), "clicked", GTK_SIGNAL_FUNC(dologin_all), NULL); - gtk_signal_connect(GTK_OBJECT(options), "clicked", GTK_SIGNAL_FUNC(show_prefs), NULL); - gtk_signal_connect(GTK_OBJECT(plugs), "clicked", GTK_SIGNAL_FUNC(show_about), NULL); - gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0); + button = gaim_pixbuf_button("Sign On", "signon.png", GAIM_BUTTON_VERTICAL); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(dologin), mainwindow); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hbox), reg, TRUE, TRUE, 0); - - gtk_widget_show(reg); - gtk_widget_show(options); - gtk_widget_show(plugs); - + /* Now grab the focus that we need */ if (aim_users) { struct aim_user *c = (struct aim_user *)aim_users->data; if (c->options & OPT_USR_REM_PASS) { combo_changed(NULL, name); - gtk_widget_grab_focus(signon); + gtk_widget_grab_focus(button); } else { gtk_widget_grab_focus(pass); } @@ -382,7 +324,9 @@ gtk_widget_grab_focus(name); } - gtk_widget_show(mainwindow); + /* And raise the curtain! */ + gtk_widget_show_all(mainwindow); + } #if HAVE_SIGNAL_H diff -r 1e8c10125558 -r f09193608fd3 src/dialogs.c --- a/src/dialogs.c Fri Oct 11 21:25:48 2002 +0000 +++ b/src/dialogs.c Sat Oct 12 01:30:44 2002 +0000 @@ -106,6 +106,7 @@ static GtkWidget *rename_dialog = NULL; static GtkWidget *rename_bud_dialog = NULL; + struct confirm_del { GtkWidget *window; GtkWidget *label; @@ -4582,12 +4583,18 @@ #endif /* USE_PERL */ -GtkWidget *pixbuf_button(char *text, char *iconfile) +GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) { GtkWidget *button, *image, *label, *bbox; button = gtk_button_new(); - bbox = gtk_hbox_new(FALSE, 5); + + if (style == GAIM_BUTTON_HORIZONTAL) + bbox = gtk_hbox_new(FALSE, 5); + else + bbox = gtk_vbox_new(FALSE, 0); + gtk_container_add (GTK_CONTAINER(button), bbox); + if (iconfile) { char *filename; filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); @@ -4596,6 +4603,7 @@ gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); g_free(filename); } + if (text) { label = gtk_label_new(NULL); gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); diff -r 1e8c10125558 -r f09193608fd3 src/gaim.h --- a/src/gaim.h Fri Oct 11 21:25:48 2002 +0000 +++ b/src/gaim.h Sat Oct 12 01:30:44 2002 +0000 @@ -155,6 +155,8 @@ #define DEFAULT_INFO "Visit the Gaim website at http://gaim.sourceforge.net/." + + enum log_event { log_signon = 0, log_signoff, diff -r 1e8c10125558 -r f09193608fd3 src/prefs.c --- a/src/prefs.c Fri Oct 11 21:25:48 2002 +0000 +++ b/src/prefs.c Sat Oct 12 01:30:44 2002 +0000 @@ -1432,7 +1432,7 @@ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); - button = pixbuf_button(_("_Edit"), "edit.png"); + button = gaim_pixbuf_button(_("_Edit"), "edit.png", GAIM_BUTTON_HORIZONTAL); gtk_size_group_add_widget(sg, button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); diff -r 1e8c10125558 -r f09193608fd3 src/ui.h --- a/src/ui.h Fri Oct 11 21:25:48 2002 +0000 +++ b/src/ui.h Sat Oct 12 01:30:44 2002 +0000 @@ -67,6 +67,12 @@ #define GAIM_WARNING 2 #define GAIM_INFO 3 +typedef enum { + GAIM_BUTTON_HORIZONTAL, + GAIM_BUTTON_VERTICAL +} GaimButtonStyle; + + struct debug_window { GtkWidget *window; GtkWidget *entry; @@ -450,7 +456,7 @@ extern void load_perl_script(); extern GtkWidget *picture_button(GtkWidget *, char *, char **); extern GtkWidget *picture_button2(GtkWidget *, char *, char **, short); -extern GtkWidget *pixbuf_button(char *, char *); +extern GtkWidget *gaim_pixbuf_button(char *, char *, GaimButtonStyle); extern int file_is_dir(const char *, GtkWidget *); extern void update_privacy_connections(); extern void show_privacy_options(); @@ -497,4 +503,8 @@ extern void play_sound(int); extern void play_file(char *); +/* Fucnctions in util.c */ +extern GtkWidget *gaim_pixmap(char *, char *); +extern GdkPixbuf *gaim_pixbuf(char *, char *); + #endif /* _UI_H_ */ diff -r 1e8c10125558 -r f09193608fd3 src/util.c --- a/src/util.c Fri Oct 11 21:25:48 2002 +0000 +++ b/src/util.c Sat Oct 12 01:30:44 2002 +0000 @@ -1409,3 +1409,44 @@ return NULL; } + +GtkWidget *gaim_pixmap(char *subdir, char *iconfile) { + char *filename; + GtkWidget *image; + + if (subdir != NULL) + filename = g_build_filename (DATADIR, "pixmaps", "gaim", subdir, iconfile, NULL); + else + filename = g_build_filename (DATADIR, "pixmaps", "gaim", iconfile, NULL); + + debug_printf("Loading: %s\n", filename); + + image = gtk_image_new_from_file(filename); + + g_free(filename); + + return image; +} + +GdkPixbuf *gaim_pixbuf(char *subdir, char *iconfile) { + char *filename; + GdkPixbuf *pixbuf; + GError *err = NULL; + + if (subdir != NULL) + filename = g_build_filename (DATADIR, "pixmaps", "gaim", subdir, iconfile, NULL); + else + filename = g_build_filename (DATADIR, "pixmaps", "gaim", iconfile, NULL); + + debug_printf("Loading: %s\n", filename); + + pixbuf = gdk_pixbuf_new_from_file(filename, &err); + if (!pixbuf) { + /* FIXME: Maybe we should handle this error */ + g_error_free(err); + } + + g_free(filename); + + return pixbuf; +}