grim/guifications1

Initial revision

2003-12-27, grim
f121b75c5e2e
Initial revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ChangeLog Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,44 @@
+Version 1.5 :
+ * Fixed a bug where if a connection was canceled and then later established, no
+ guifications would be shown for that account
+ * Snakez added a toggle to hide guifications while away
+ * Fixed some errors and left out information in the INSTALL file
+ * Fixed a bug where local and server alias would not be displayed correct if they
+ contained html special chars
+
+Version 1.4 12/08/03:
+ * Added user defined mouse buttons for clicking on a guification. These
+ include: Close Window, Get Info, Open Conversation, View Log, and the main
+ context menu from the buddy list.
+ * Potential bug where and image gets set with a notification up removed.
+ This really wasn't a bug, but it just looked bad.
+ * Made clicking a guification to open a window switch to that tab if tab
+ windows are enabled and a conversation is already open.
+ * Added release notification. Theres a toggle for it on the advanced tab.
+ * Fixed "growing" option menus (dropdown lists)
+ * Added the ability to "zoom" the guifications
+
+Version 1.3 11/03/03:
+ * Notifications will now open up an IM window when they are clicked. This
+ is probably buggy, so play with it and let me know.
+ * Fixed the bug where the notifications were only showing if all events
+ were checked
+ * Added message box if an invalid image file is selected
+
+Version 1.2 11/01/03:
+ * Fixed a compile warning
+ * Took animation out completely, I got it working but it looked like crap so
+ I just removed it all together.
+ * Windows makefiles added and it should compile under windows now
+ * Windows binary added to sf releases
+ * Debugging output added to all functions
+
+Version 1.1 10/29/03:
+ * Fixed an issue with the file selection dialog showing the current font
+ as the previous image
+ * Other random fixes and clean ups in the configuration window
+
+Version 1.0 10/29/03:
+ * Everything in the configuration window is working except for animations.
+ Since I haven't come up with a decent and effective way to do it yet, it
+ will have to wait.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,57 @@
+To Compile
+==========
+
+I'm aiming for this plugin to be distributed with gaim, even though I know
+how against that Sean is. But anyways, here's what you have to do to get
+this to compile.
+
+The only dependices guifications have that gaim doesn't are these packages:
+
+ libgdk-pixbuf-dev
+ libgdk-pixbuf2
+
+Please make sure these are installed prior to compiling, otherwise gaim will
+not be able to load guifications.
+
+For starters extract the source into:
+
+ gaim-source-tree/plugins/
+
+gaim-source being what ever path you extracted the gaim source tree to.
+
+For example, if your gaim source tree is in /usr/local/src/gaim-VERSION
+you want to "cd" over to /usr/local/src/gaim-VERSION/plugins/ and type:
+
+ tar zxvf guifications-VERSION.tar.gz
+
+Now that you've gotten the source installed you have to modify gaim's main
+autoconfig script. (Like I said this is aiming to be distributed with gaim)
+so "cd" back to the top of the gaim source tree "cd .."
+
+Open up configure.ac in your favorite editor and look for this line:
+
+ AC_OUTPUT([Makefile
+
+That's currently line 957 in the cvs (don't use that by the way)
+
+Somewhere in this block you want to add these two lines:
+
+ plugins/guifications/Makefile
+ plugins/guifications/pixmaps/Makefile
+
+They must be before the closing ]) otherwise you'll mess up the whole script.
+
+Save configure.ac then run automake, autoconfig, and configure in that order:
+
+ automake --add-missing --copy
+ autoconf
+ ./configure
+
+Once gaim is done configuring, cd to plugins/guifications
+
+type:
+
+ make
+ make install
+
+And you should be good to go. Restart gaim and try it out.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL.WIN32 Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,38 @@
+Install
+=======
+
+To install Guifications, simply extract the contents of this zip file
+to your gaim install directory, which is C:\Program Files\Gaim by
+default.
+
+To Compile
+==========
+
+I'm aiming for this plugin to be distributed with gaim, even though I know
+how against that Sean is. But anyways, here's what you have to do to get
+this to compile.
+
+For starters extract the source into:
+
+ gaim-source-tree/plugins/
+
+gaim-source being what ever path you extracted the gaim source tree to.
+
+For example, if your gaim source tree is in /usr/local/src/gaim-VERSION
+you want to "cd" over to /usr/local/src/gaim-VERSION/plugins/ and type:
+
+ tar zxvf guifications-VERSION.tar.gz
+
+Then cd into the source dir
+
+ cd guifications-VERSION
+
+Then type
+
+ make -f Makefile.mingw
+ make -f Makefile.mingw install
+
+When it's done building copy guifications.dll and the pixmaps dir from your
+win32-install-dir to your gaim install dir.
+
+And you should be good to go. Restart gaim and try it out.
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.am Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,56 @@
+EXTRA_DIST = \
+ README \
+ README.WIN32 \
+ INSTALL \
+ INSTALL.WIN32 \
+ TODO \
+ ChangeLog \
+ Makefile.mingw
+
+SUBDIRS = pixmaps
+
+plugindir = $(libdir)/gaim
+
+guificat_la_LDFLAGS = -module -avoid-version
+
+if PLUGINS
+
+plugin_LTLIBRARIES = guificat.la
+
+guificat_la_SOURCES = \
+ guifications.c \
+ guificatoins.h \
+ gf_conf.c \
+ gf_conf.h \
+ gf_prefs.c \
+ gf_prefs.h \
+ gf_utils.c \
+ gf_utils.h \
+ gf_pngs.c \
+ gf_pngs.h
+
+bin_PROGRAMS = gf_theme_edit
+
+gf_theme_edit_SOURCES = \
+ gf_theme_editor.c \
+ gf_pngs.c \
+ grimdirtreeview.c
+
+gf_theme_edit_DEPENDENCIES = \
+ @LIBOBJS@ \
+ $(top_srcdir)/src/xmlnode.o
+
+gf_theme_edit_LDADD = \
+ @LIBOBJS@ \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(top_srcdir)/src/xmlnode.o
+
+endif
+
+AM_CPPFLAGS = \
+ -DDATADIR=\"$(datadir)\" \
+ -DVERSION=\"$(VERSION)\" \
+ -I$(top_srcdir)/src \
+ $(DEBUG_CFLAGS) \
+ $(GTK_CFLAGS)
--- a/Makefile.mingw Sat Dec 27 14:20:24 2003 +0000
+++ b/Makefile.mingw Sat Dec 27 14:28:54 2003 +0000
@@ -67,7 +67,7 @@
C_SRC2 = \
gf_theme_editor.c \
guifications.c \
- grimdirtreeview.c
+ gtkdirtreeview.c
OBJECTS = $(C_SRC:%.c=%.o)
OBJECTS2 = $(C_SRC2:%.c=%.o)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,18 @@
+Guifications:
+ The Pimpin' Penguin Notification Plugin thats good for the soul!
+
+Authors
+=======
+Gary Kramlich <grim@reaperworld.com>
+Ray Cockburn <snakez@l33t-2k.net>
+
+Special Thanks
+==============
+Stu Tomlinson for the rpm's
+
+About
+=====
+Guifications, are notifications windows styled after those found in msn,
+deadim, and newer version of aim. I've fashioned them after being as
+user customizable as possible. It is entirely gtk based and there for
+should compile on anything that gaim will compile on.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.WIN32 Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,20 @@
+Guifications:
+ The Pimpin' Penguin Notification Plugin thats good for the soul!
+
+Authors
+=======
+Gary Kramlich <grim@reaperworld.com>
+Ray Cockburn <snakez@l33t-2k.net>
+
+About
+=====
+Guifications, are notifications windows styled after those found in msn,
+deadim, and newer version of aim. I've fashioned them after being as
+user customizable as possible. It is entirely gtk based and there for
+should compile on anything that gaim will compile on.
+
+Install
+=======
+To install Guifications, simply extract the contents of this zip file
+to your gaim install directory, which is C:\Program Files\Gaim by
+default.
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TODO Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,4 @@
+TODO
+====
+Add theme support
+Add Signal so other plugins can create guifications
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_conf.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,1148 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#include <gdk/gdk.h>
+
+#include "gaim.h"
+#include "plugin.h"
+#include "gtkplugin.h"
+#include "gtkutils.h"
+#include "prefs.h"
+#include "debug.h"
+
+#include "guifications.h"
+#include "gf_conf.h"
+#include "gf_prefs.h"
+#include "gf_pngs.h"
+/***********************************************************************
+ Globals
+***********************************************************************/
+GtkWidget *btn_image;
+GtkWidget *btn_font;
+GtkWidget *btn_color;
+GtkWidget *edt_image;
+GtkWidget *evt_color;
+GtkWidget *img_preview;
+/***********************************************************************
+ Prototypes
+***********************************************************************/
+static GtkWidget *make_label( gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_check_button( const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_entry( const gchar *pref );
+static GtkWidget *make_button( gchar *text );
+static GtkWidget *make_spin_button_with_label( gchar *text, const gchar *pref, GtkSizeGroup *sg );
+static GtkWidget *make_gfpos_option_menu_with_label( const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_gfpos_menu_item(gf_gfpos pos);
+static GtkWidget *make_clip_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_clip_menu_item(gf_clip clip);
+static GtkWidget *make_tpos_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_tpos_menu_item(gf_tpos pos);
+static GtkWidget *make_ipos_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_ipos_menu_item(gf_ipos pos);
+static GtkWidget *make_icon_size_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg );
+static GtkWidget *make_icon_size_menu_item(gf_icon_size isize);
+static GtkWidget *make_zoom_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg);
+static GtkWidget *make_zoom_menu_item(gf_zoom zoom);
+static GtkWidget *make_mouse_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg);
+static GtkWidget *make_mouse_menu_item(gf_mouse mouse);
+static void make_color_preview( GtkWidget *image, const gchar *color );
+
+/* callbacks */
+static void chk_box_cb( GtkWidget *check, const gchar *pref );
+static void spn_btn_cb( GtkWidget *spin, const gchar *pref );
+static void opt_mnu_cb( GtkWidget *opt_menu, const gchar *pref );
+static gboolean edt_box_cb( GtkWidget *entry, GdkEventFocus *event, const gchar *pref );
+static void image_file_ok( GtkWidget *widget, gpointer data );
+static void image_file_dialog( GtkWidget *check, gpointer data );
+static void font_ok( GtkWidget *widget, gpointer data );
+static void font_dialog( GtkWidget *check, gpointer data );
+static void color_ok( GtkWidget *widget, gpointer data );
+static void color_dialog( GtkWidget *widget, gpointer data );
+/**********************************************************************/
+GtkWidget *
+get_config_frame(GaimPlugin *plugin) {
+ GtkWidget *note, *vbox, *vbox2, *hbox, *frame, *label, *spin;
+ GtkWidget *chk_btn, *opt_mnu, *edt_box;
+ GtkSizeGroup *sg;
+ gint pad_x, pad_y;
+
+ pad_x = pad_y = 5;
+
+ /* create notebook */
+ note = gtk_notebook_new();
+
+ /*******************************************************************
+ behavior tab
+ *******************************************************************/
+ /* setup behavior sizegroup */
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* create behavior tab */
+ vbox = gtk_vbox_new(FALSE, 4);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ label = gtk_label_new("Behavior");
+ gtk_notebook_insert_page(GTK_NOTEBOOK(note), vbox, label, -1);
+
+ /* create notification frame */
+ frame = gaim_gtk_make_frame(vbox, "Notifications");
+
+ /* create notification vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create sign on/off hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create sign on check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_SIGN_ON, "Show _Sign On", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0 );
+
+ /* create sign off check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_SIGN_OFF, "Show Sign _Off", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create away/back hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create away check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_AWAY, "Show _Away", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0 );
+
+ /* create back check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_BACK, "Show _Back", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create idle/unidle hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create idle check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_IDLE, "Show _Idle", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create unidle check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOW_UNIDLE, "Show _Unidle", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create position frame */
+ frame = gaim_gtk_make_frame(vbox, "Position");
+
+ /* create position vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create position option menu */
+ opt_mnu = make_gfpos_option_menu_with_label(GF_PREF_BEHAVIOR_WINDOW_POS, "_Position:", sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), opt_mnu);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create vertical check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_WINDOW_VERTICAL, "_Vertical", sg);
+ gtk_box_pack_start(GTK_BOX(vbox2), chk_btn, FALSE, FALSE, 0);
+
+ /* create display frame */
+ frame = gaim_gtk_make_frame(vbox, "Display");
+
+ /* create display vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create display spin */
+ spin = make_spin_button_with_label("Display _time:", GF_PREF_BEHAVIOR_TIMEOUT, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ label = make_label("seconds", NULL);
+ gtk_box_pack_start(GTK_BOX( spin ), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox2), spin, FALSE, FALSE, 0);
+
+ /* create zoom option menu */
+ opt_mnu = make_zoom_option_menu_with_label(GF_PREF_BEHAVIOR_ZOOM, "_Zoom:", sg);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create alias check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_ALIAS, "S_how alias if set", NULL);
+ gtk_box_pack_start(GTK_BOX(vbox2), chk_btn, FALSE, FALSE, 0);
+
+ /* snakez */
+ /* show if away check */
+ chk_btn = make_check_button(GF_PREF_BEHAVIOR_SHOWAWAY, "Sho_w Guifications while away", NULL);
+ gtk_box_pack_start(GTK_BOX(vbox2), chk_btn, FALSE, FALSE, 0);
+
+ /* create mouse frame */
+ frame = gaim_gtk_make_frame(vbox, "Mouse");
+
+ /* create mouse1 option */
+ opt_mnu = make_mouse_option_menu_with_label(GF_PREF_BEHAVIOR_MOUSE1, "_Left Button:", sg);
+ gtk_box_pack_start(GTK_BOX(frame), opt_mnu, FALSE, FALSE, 0);
+
+ /* create mouse2 option */
+ opt_mnu = make_mouse_option_menu_with_label(GF_PREF_BEHAVIOR_MOUSE2, "_Middle Button:", sg);
+ gtk_box_pack_start(GTK_BOX(frame), opt_mnu, FALSE, FALSE, 0);
+
+ /* create mouse3 option */
+ opt_mnu = make_mouse_option_menu_with_label(GF_PREF_BEHAVIOR_MOUSE3, "_Right Button:", sg);
+ gtk_box_pack_start(GTK_BOX(frame), opt_mnu, FALSE, FALSE, 0);
+
+ /*******************************************************************
+ appearance tab
+ *******************************************************************/
+ /* make appearance sizegroup */
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* create appearance tab */
+ vbox = gtk_vbox_new(FALSE, 4);
+ label = gtk_label_new("Appearance");
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(note), vbox, label, -1);
+
+ /* create image frame */
+ frame = gaim_gtk_make_frame(vbox, "Image");
+
+ /* create image vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create image check */
+ chk_btn = make_check_button(GF_PREF_APPEARANCE_IMAGE, "Use custom _image", sg);
+ gtk_box_pack_start(GTK_BOX(vbox2), chk_btn, FALSE, FALSE, 0);
+
+ /* create image entry/button hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create image edit box */
+ edt_image = make_entry(GF_PREF_APPEARANCE_IMAGE_FILE);
+ gtk_widget_set_sensitive(edt_image, FALSE);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_image, FALSE, FALSE, 0);
+
+ /* create image button */
+ btn_image = make_button("_Browse");
+ gtk_widget_set_sensitive(btn_image, gaim_prefs_get_bool(GF_PREF_APPEARANCE_IMAGE));
+ g_signal_connect(G_OBJECT(btn_image), "clicked", G_CALLBACK(image_file_dialog), NULL);
+ gtk_box_pack_start(GTK_BOX(hbox), btn_image, FALSE, FALSE, 0);
+
+ /* create text frame */
+ frame = gaim_gtk_make_frame(vbox, "Text");
+
+ /* create text vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create font hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create font check */
+ chk_btn = make_check_button(GF_PREF_APPEARANCE_FONT, "Use custom fon_t", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create font button */
+ btn_font = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT);
+ gtk_widget_set_sensitive(btn_font, gaim_prefs_get_bool(GF_PREF_APPEARANCE_FONT));
+ g_signal_connect(G_OBJECT(btn_font), "clicked", G_CALLBACK(font_dialog), NULL);
+ gtk_box_pack_start(GTK_BOX(hbox), btn_font, FALSE, FALSE, 0);
+
+ /* create color hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create color check */
+ chk_btn = make_check_button(GF_PREF_APPEARANCE_COLOR, "Use custom co_lor", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), chk_btn, FALSE, FALSE, 0);
+
+ /* create color button */
+ btn_color = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR);
+ gtk_widget_set_sensitive(btn_color, gaim_prefs_get_bool(GF_PREF_APPEARANCE_COLOR));
+ g_signal_connect(G_OBJECT(btn_color), "clicked", G_CALLBACK(color_dialog), NULL);
+ gtk_box_pack_start(GTK_BOX(hbox), btn_color, FALSE, FALSE, 0);
+
+ /* create color event box */
+ evt_color = gtk_event_box_new();
+ gtk_widget_set_size_request(evt_color, 50, -1);
+ make_color_preview(evt_color, gaim_prefs_get_string(GF_PREF_COLORS_FOREGROUND));
+ gtk_box_pack_start(GTK_BOX(hbox), evt_color, FALSE, FALSE, 0);
+
+ /* create clipping option menu */
+ opt_mnu = make_clip_option_menu_with_label(GF_PREF_APPEARANCE_TEXT_CLIPPING, "Clippin_g:", sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), opt_mnu);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create position option menu */
+ opt_mnu = make_tpos_option_menu_with_label(GF_PREF_APPEARANCE_TEXT_POS, "_Position:", sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), opt_mnu);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create horz spin */
+ spin = make_spin_button_with_label("_Horizontal Offset:", GF_PREF_APPEARANCE_TEXT_X, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ gtk_box_pack_start(GTK_BOX(vbox2), spin, FALSE, FALSE, 0);
+
+ /* create vert spin */
+ spin = make_spin_button_with_label("_Vertical Offset:", GF_PREF_APPEARANCE_TEXT_Y, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ gtk_box_pack_start(GTK_BOX(vbox2), spin, FALSE, FALSE, 0);
+
+ /* create protocol frame */
+ frame = gaim_gtk_make_frame(vbox, "Protocol");
+
+ /* create procotol vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create position option menu */
+ opt_mnu = make_ipos_option_menu_with_label(GF_PREF_APPEARANCE_PROT_POS, "P_osition:", sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), opt_mnu);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create size option menu */
+ opt_mnu = make_icon_size_option_menu_with_label(GF_PREF_APPEARANCE_PROT_SIZE, "Si_ze:", sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), opt_mnu);
+ gtk_box_pack_start(GTK_BOX(vbox2), opt_mnu, FALSE, FALSE, 0);
+
+ /* create horz spin */
+ spin = make_spin_button_with_label("Ho_rizontal Offset:", GF_PREF_APPEARANCE_PROT_X, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ gtk_box_pack_start(GTK_BOX(vbox2), spin, FALSE, FALSE, 0);
+
+ /* create vert spin */
+ spin = make_spin_button_with_label("Ver_tical Offset:", GF_PREF_APPEARANCE_PROT_Y, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ gtk_box_pack_start(GTK_BOX(vbox2), spin, FALSE, FALSE, 0);
+
+ /*******************************************************************
+ Messages tab
+ *******************************************************************/
+ /* make messages size group */
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* create message tab */
+ vbox = gtk_vbox_new(FALSE, 4);
+ label = gtk_label_new("Messages");
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(note), vbox, label, -1);
+
+ /* create messages frame */
+ frame = gaim_gtk_make_frame(vbox, "Status Messages");
+
+ /* create messages vbox */
+ vbox2 = gtk_vbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(frame), vbox2);
+
+ /* create sign on hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create sign on label */
+ label = make_label("_Sign on:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create sign on edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_SIGN_ON);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /* create sign off hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create sign off label */
+ label = make_label("Sign _off:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create sign off edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_SIGN_OFF);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /* create away hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create away label */
+ label = make_label("_Away:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create away edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_AWAY);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /* create back hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create back label */
+ label = make_label("_Back:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create back edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_BACK);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /* create idle hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create idle label */
+ label = make_label("_Idle:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create idle edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_IDLE);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /* create unidle hbox */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+
+ /* create unidle label */
+ label = make_label("_Unidle:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ /* create unidle edit */
+ edt_box = make_entry(GF_PREF_MESSAGES_UNIDLE);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), edt_box);
+ gtk_box_pack_start(GTK_BOX(hbox), edt_box, FALSE, FALSE, 0);
+
+ /*******************************************************************
+ Advanced tab
+ *******************************************************************/
+ /* make advanced sizeground */
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* create advanced tab */
+ vbox = gtk_vbox_new(FALSE, 4);
+ label = gtk_label_new("Advanced");
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(note), vbox, label, -1);
+
+ /* create release notification frame */
+ frame = gaim_gtk_make_frame(vbox, "Release Notification");
+
+ /* create release notification check */
+ chk_btn = make_check_button(GF_PREF_ADVANCED_RELEASE, "Check for new releases", sg);
+ gtk_box_pack_start(GTK_BOX(frame), chk_btn, FALSE, FALSE, 0);
+
+ /* create behavior frame */
+ frame = gaim_gtk_make_frame(vbox, "Behavior");
+
+ /* create sign on spin */
+ spin = make_spin_button_with_label("_Sign on delay:", GF_PREF_ADVANCED_DELAY, sg);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+ gtk_box_pack_start(GTK_BOX(frame), spin, FALSE, FALSE, 0);
+
+ /* create sign on description */
+ label = make_label("milliseconds", NULL);
+ gtk_box_pack_start(GTK_BOX(spin), label, FALSE, FALSE, 0);
+
+ gtk_widget_show_all(note);
+
+ g_object_unref(sg);
+
+ return note;
+}
+/**********************************************************************/
+static void
+make_color_preview(GtkWidget *image, const gchar *color) {
+ GtkStyle *style;
+ GdkColor gcolor;
+ PangoColor pcolor;
+
+ gcolor.pixel = 0;
+
+ if (gaim_prefs_get_bool(GF_PREF_APPEARANCE_COLOR))
+ {
+ pango_color_parse(&pcolor, color);
+ gcolor.red = pcolor.red;
+ gcolor.green = pcolor.green;
+ gcolor.blue = pcolor.blue;
+ }
+ else
+ gcolor.red = gcolor.green = gcolor.blue = 0;
+
+ style = gtk_style_new();
+ style->bg[0] = gcolor;
+ gtk_widget_set_style(image, style);
+ g_object_unref(style);
+}
+/**********************************************************************/
+static GtkWidget *
+make_label(gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *ret;
+
+ ret = gtk_label_new_with_mnemonic(text);
+ gtk_misc_set_alignment(GTK_MISC(ret), 0.0, 0.5);
+
+ if (sg)
+ gtk_size_group_add_widget(sg, ret);
+
+ return ret;
+}
+/**********************************************************************/
+static GtkWidget *
+make_check_button(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *chk_btn;
+
+ chk_btn = gtk_check_button_new_with_mnemonic(text);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk_btn), gaim_prefs_get_bool(pref));
+ g_signal_connect(G_OBJECT(chk_btn), "clicked", G_CALLBACK(chk_box_cb), (gpointer)pref);
+
+ if (sg)
+ gtk_size_group_add_widget(sg, chk_btn);
+
+ return chk_btn;
+}
+/**********************************************************************/
+static GtkWidget *
+make_entry(const gchar *pref) {
+ GtkWidget *entry;
+
+ entry = gtk_entry_new();
+
+ gtk_entry_set_text(GTK_ENTRY(entry), gaim_prefs_get_string(pref));
+ g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(edt_box_cb), (gpointer)pref);
+
+ return entry;
+}
+/**********************************************************************/
+static GtkWidget *
+make_button(gchar *text) {
+ GtkWidget *ret;
+
+ ret = gtk_button_new_with_mnemonic(text);
+
+ return ret;
+}
+/**********************************************************************/
+static GtkWidget *
+make_spin_button_with_label(gchar *text, const gchar *pref, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *label, *spin;
+ GtkObject *adjustment;
+ gdouble value = 0, max = 0, step = 0, page = 0;
+
+ if (pref == GF_PREF_BEHAVIOR_TIMEOUT)
+ max = 60;
+ else if (pref == GF_PREF_ADVANCED_DELAY)
+ max = 30000;
+ else
+ max = 255;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = gtk_label_new_with_mnemonic(text);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.05, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ value = gaim_prefs_get_int(pref);
+ step = 1;
+ page = 10;
+
+ adjustment = gtk_adjustment_new(value, 0, max, step, page, 10);
+
+ spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 1, 0);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spin), TRUE);
+ gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(spin), "changed", G_CALLBACK(spn_btn_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
+
+ if (sg)
+ gtk_size_group_add_widget(sg, label);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_gfpos_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *label, *option_menu, *menu;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 4; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_gfpos_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history( GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_gfpos_menu_item(gf_gfpos pos) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_window_image(pos);
+
+ switch (pos)
+ {
+ case gfpos_nw: label = gtk_label_new("Top Left"); break;
+ case gfpos_ne: label = gtk_label_new("Top Right"); break;
+ case gfpos_sw: label = gtk_label_new("Bottom Left"); break;
+ case gfpos_se: label = gtk_label_new("Bottom Right"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5 );
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_clip_option_menu_with_label( const gchar *pref, gchar *text, GtkSizeGroup *sg ) {
+ GtkWidget *hbox, *label, *option_menu, *menu;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 4; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_clip_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_clip_menu_item(gf_clip clip) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_clipping_image(clip);
+
+ switch (clip)
+ {
+ case clip_truncate: label = gtk_label_new("Truncate"); break;
+ case clip_elipse_start: label = gtk_label_new("Elipse at the beginning"); break;
+ case clip_elipse_middle: label = gtk_label_new("Elipse in the middle"); break;
+ case clip_elipse_end: label = gtk_label_new("Elipse at the end"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_tpos_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *label, *option_menu, *menu;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 9; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_tpos_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_tpos_menu_item(gf_tpos pos) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_text_position_image(pos);
+
+ switch (pos)
+ {
+ case tpos_nw: label = gtk_label_new("Top Left"); break;
+ case tpos_n: label = gtk_label_new("Top"); break;
+ case tpos_ne: label = gtk_label_new("Top Right"); break;
+ case tpos_w: label = gtk_label_new("Left"); break;
+ case tpos_c: label = gtk_label_new("Center"); break;
+ case tpos_e: label = gtk_label_new("Right"); break;
+ case tpos_sw: label = gtk_label_new("Bottom Left"); break;
+ case tpos_s: label = gtk_label_new("Bottom"); break;
+ case tpos_se: label = gtk_label_new("Bottom Right"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_ipos_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *label, *option_menu, *menu;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 10; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_ipos_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_ipos_menu_item(gf_ipos pos) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_icon_position_image(pos);
+
+ switch (pos)
+ {
+ case ipos_none: label = gtk_label_new("None"); break;
+ case ipos_nw: label = gtk_label_new("Top Left"); break;
+ case ipos_n: label = gtk_label_new("Top"); break;
+ case ipos_ne: label = gtk_label_new("Top Right"); break;
+ case ipos_w: label = gtk_label_new("Left"); break;
+ case ipos_c: label = gtk_label_new("Center"); break;
+ case ipos_e: label = gtk_label_new("Right"); break;
+ case ipos_sw: label = gtk_label_new("Bottom Left"); break;
+ case ipos_s: label = gtk_label_new("Bottom"); break;
+ case ipos_se: label = gtk_label_new("Bottom Right"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_size_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *label, *option_menu, *menu;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 5; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_icon_size_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_size_menu_item(gf_icon_size isize) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_icon_size_image(isize);
+
+ switch (isize)
+ {
+ case isize_tiny: label = gtk_label_new("Tiny (16x16)"); break;
+ case isize_small: label = gtk_label_new("Small (24x24)"); break;
+ case isize_normal: label = gtk_label_new("Normal (48x48)"); break;
+ case isize_large: label = gtk_label_new("Large (96x96)"); break;
+ case isize_huge: label = gtk_label_new("Huge (144x144)"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_zoom_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *hbox, *option_menu, *menu, *label;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 8; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_zoom_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref);
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_zoom_menu_item(gf_zoom zoom) {
+ GtkWidget *hbox, *item, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_zoom_image(zoom);
+
+ switch(zoom) {
+ case zoom_200: label = gtk_label_new("200%"); break;
+ case zoom_175: label = gtk_label_new("175%"); break;
+ case zoom_150: label = gtk_label_new("150%"); break;
+ case zoom_125: label = gtk_label_new("125%"); break;
+ case zoom_100: label = gtk_label_new("100%"); break;
+ case zoom_75: label = gtk_label_new("75%"); break;
+ case zoom_50: label = gtk_label_new("50%"); break;
+ case zoom_25: label = gtk_label_new("25%"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_mouse_option_menu_with_label(const gchar *pref, gchar *text, GtkSizeGroup *sg)
+{
+ GtkWidget *hbox, *option_menu, *menu, *label;
+ gint i;
+
+ hbox = gtk_hbox_new(FALSE, 4);
+
+ label = make_label(text, sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < mouse_count; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_mouse_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), gaim_prefs_get_int(pref));
+ g_signal_connect(G_OBJECT(option_menu), "changed", G_CALLBACK(opt_mnu_cb), (gpointer)pref );
+
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), option_menu);
+
+ gtk_box_pack_start(GTK_BOX(hbox), option_menu, FALSE, FALSE, 0);
+
+ return hbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_mouse_menu_item(gf_mouse mouse) {
+ GtkWidget *hbox, *item, *label = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ switch(mouse)
+ {
+ case mouse_destroy: label = gtk_label_new("Close Window"); break;
+ case mouse_info: label = gtk_label_new("Buddy Info"); break;
+ case mouse_conversation: label = gtk_label_new("Open Conversation"); break;
+ case mouse_log: label = gtk_label_new("View Log"); break;
+ case mouse_context: label = gtk_label_new("Context Menu"); break;
+ case mouse_count: return NULL; break;
+ }
+
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/***********************************************************************
+ Callbacks
+***********************************************************************/
+static void
+chk_box_cb(GtkWidget *check, const gchar *pref) {
+ gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
+
+ gaim_prefs_set_bool(pref, enabled);
+
+ if (g_ascii_strcasecmp(pref, GF_PREF_APPEARANCE_IMAGE) == 0)
+ gtk_widget_set_sensitive(btn_image, enabled);
+ else if (g_ascii_strcasecmp(pref, GF_PREF_APPEARANCE_FONT) == 0)
+ gtk_widget_set_sensitive(btn_font, enabled);
+ else if (g_ascii_strcasecmp(pref, GF_PREF_APPEARANCE_COLOR) == 0) {
+ gtk_widget_set_sensitive(btn_color, enabled);
+ make_color_preview(evt_color, gaim_prefs_get_string(GF_PREF_COLORS_FOREGROUND));
+ }
+}
+/**********************************************************************/
+static void
+spn_btn_cb(GtkWidget *spin, const gchar *pref) {
+ gaim_prefs_set_int(pref, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)));
+}
+/**********************************************************************/
+static void
+opt_mnu_cb(GtkWidget *opt_menu, const gchar *pref) {
+ if (g_ascii_strcasecmp(pref, GF_PREF_BEHAVIOR_ZOOM) == 0)
+ gf_destroy_all();
+
+ gaim_prefs_set_int(pref, gtk_option_menu_get_history(GTK_OPTION_MENU(opt_menu)));
+}
+/**********************************************************************/
+static gboolean
+edt_box_cb(GtkWidget *entry, GdkEventFocus *event, const gchar *pref) {
+ gaim_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry)));
+
+ return FALSE;
+}
+/**********************************************************************/
+static void
+image_file_dialog(GtkWidget *check, gpointer data) {
+ GtkWidget *file_sel;
+
+ file_sel = gtk_file_selection_new("Select a background image");
+
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_sel), gaim_prefs_get_string(GF_PREF_APPEARANCE_IMAGE_FILE));
+ gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(file_sel));
+ g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(file_sel)->ok_button), "clicked", G_CALLBACK(image_file_ok), (gpointer)file_sel);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(file_sel)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)file_sel);
+ g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(file_sel)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)file_sel);
+
+ gtk_widget_show(file_sel);
+}
+/**********************************************************************/
+static void
+image_file_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *file_sel = (GtkWidget*)data, *message_box = NULL;
+ const gchar *file;
+ GdkPixbuf *pixbuf;
+
+ file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_sel));
+
+ pixbuf = gdk_pixbuf_new_from_file(file, NULL);
+
+ if (pixbuf != NULL) {
+ gf_destroy_all();
+ gaim_prefs_set_string(GF_PREF_APPEARANCE_IMAGE_FILE, file);
+ g_object_unref(pixbuf);
+ gtk_entry_set_text(GTK_ENTRY(edt_image), file);
+ }
+ else {
+ message_box = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "The file \"%s\" is not a valid image file", file);
+ g_signal_connect_swapped(G_OBJECT(message_box), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(message_box));
+ gtk_widget_show(message_box);
+ }
+}
+/**********************************************************************/
+static void
+font_dialog(GtkWidget *check, gpointer data) {
+ GtkWidget *font_sel;
+
+ font_sel = gtk_font_selection_dialog_new("Select Font");
+
+ gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(font_sel), gaim_prefs_get_string(GF_PREF_APPEARANCE_FONT_FACE));
+ gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(font_sel), "Guifications");
+ g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel)->ok_button), "clicked", G_CALLBACK(font_ok), (gpointer)font_sel);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)font_sel);
+ g_signal_connect_swapped(G_OBJECT(GTK_FONT_SELECTION_DIALOG(font_sel)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)font_sel);
+
+ gtk_widget_show(font_sel);
+}
+/**********************************************************************/
+static void
+font_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *font_sel = (GtkWidget*)data;
+ const gchar *face;
+
+ face = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_sel));
+
+ gaim_prefs_set_string(GF_PREF_APPEARANCE_FONT_FACE, face);
+}
+/**********************************************************************/
+static void
+color_dialog(GtkWidget *widget, gpointer data) {
+ GtkWidget *color_sel;
+ GdkColor color;
+ PangoColor pcolor;
+
+ pango_color_parse(&pcolor, gaim_prefs_get_string(GF_PREF_COLORS_FOREGROUND));
+ color.red = pcolor.red;
+ color.green = pcolor.green;
+ color.blue = pcolor.blue;
+
+ color_sel = gtk_color_selection_dialog_new("Select Font Color");
+
+ gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_sel)->colorsel), &color);
+ g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_sel)->ok_button), "clicked", G_CALLBACK(color_ok), (gpointer)color_sel);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_sel)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)color_sel);
+ g_signal_connect_swapped(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_sel)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)color_sel);
+
+ gtk_widget_show(color_sel);
+}
+/**********************************************************************/
+static void
+color_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *color_sel = (GtkWidget*)data;
+ GdkColor color;
+ char buf[14];
+
+ gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_sel)->colorsel), &color);
+
+ g_snprintf(buf, sizeof(buf), "#%04x%04x%04x", color.red, color.green, color.blue);
+
+ make_color_preview(evt_color, buf);
+
+ gaim_prefs_set_string(GF_PREF_COLORS_FOREGROUND, buf);
+}
+/**********************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_conf.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,30 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#ifndef GF_CONF_H
+#define GF_CONF_H
+
+#include <gtk/gtk.h>
+#include <plugin.h>
+/***********************************************************************
+ Prototypes
+***********************************************************************/
+GtkWidget *get_config_frame(GaimPlugin *plugin);
+/**********************************************************************/
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_pngs.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,233 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "debug.h"
+
+#ifdef _WIN32
+#include "win32dep.h"
+#endif
+
+#include "gf_pngs.h"
+#include "guifications.h"
+
+/**********************************************************************/
+gchar *
+gf_get_image_dir() {
+ return g_build_filename(DATADIR, "pixmaps", "gaim", "guifications", NULL);
+}
+/**********************************************************************/
+GdkPixbuf *
+get_def_background_image() {
+ GdkPixbuf *ret;
+
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "backgrounds", "background_default.png", NULL), NULL);
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_clipping_image(gf_clip clip) {
+ GdkPixbuf *ret;
+
+ switch(clip) {
+ case clip_elipse_start:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "clip_elipse_start.png", NULL), NULL);
+ break;
+ case clip_elipse_middle:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "clip_elipse_middle.png", NULL), NULL);
+ break;
+ case clip_elipse_end:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "clip_elipse_end.png", NULL), NULL);
+ break;
+ case clip_truncate:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "clip_truncate.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_text_position_image(gf_tpos pos) {
+ GdkPixbuf *ret;
+
+ switch (pos)
+ {
+ case tpos_nw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north_west.png", NULL), NULL);
+ break;
+ case tpos_n:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north.png", NULL), NULL);
+ break;
+ case tpos_ne:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north_east.png", NULL), NULL);
+ break;
+ case tpos_w:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_west.png", NULL), NULL);
+ break;
+ case tpos_c:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_center.png", NULL), NULL);
+ break;
+ case tpos_e:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_east.png", NULL), NULL);
+ break;
+ case tpos_sw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south_west.png", NULL), NULL);
+ break;
+ case tpos_s:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south.png", NULL), NULL);
+ break;
+ case tpos_se:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south_east.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_icon_position_image(gf_ipos pos) {
+ GdkPixbuf *ret;
+
+ switch (pos) {
+ case ipos_none:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_none.png", NULL), NULL);
+ break;
+ case ipos_nw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north_west.png", NULL), NULL);
+ break;
+ case ipos_n:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north.png", NULL), NULL);
+ break;
+ case ipos_ne:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_north_east.png", NULL), NULL);
+ break;
+ case ipos_w:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_west.png", NULL), NULL);
+ break;
+ case ipos_c:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_center.png", NULL), NULL);
+ break;
+ case ipos_e:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_east.png", NULL), NULL);
+ break;
+ case ipos_sw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south_west.png", NULL), NULL);
+ break;
+ case ipos_s:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south.png", NULL), NULL);
+ break;
+ case ipos_se:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "position_south_east.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_icon_size_image(gf_icon_size size) {
+ GdkPixbuf *ret;
+
+ switch(size) {
+ case isize_huge:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "protocol_size_huge.png", NULL), NULL);
+ break;
+ case isize_large:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "protocol_size_large.png", NULL), NULL);
+ break;
+ case isize_normal:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "protocol_size_normal.png", NULL), NULL);
+ break;
+ case isize_small:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "protocol_size_small.png", NULL), NULL);
+ break;
+ case isize_tiny:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "protocol_size_tiny.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_window_image(gf_gfpos pos) {
+ GdkPixbuf *ret;
+
+ switch(pos) {
+ case gfpos_nw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "window_position_north_west.png", NULL), NULL);
+ break;
+ case gfpos_ne:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "window_position_north_east.png", NULL), NULL);
+ break;
+ case gfpos_sw:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "window_position_south_west.png", NULL), NULL);
+ break;
+ case gfpos_se:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "window_position_south_east.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
+GdkPixbuf *
+get_zoom_image(gf_zoom zoom) {
+ GdkPixbuf *ret;
+
+ switch(zoom) {
+ case zoom_200:
+ case zoom_175:
+ case zoom_150:
+ case zoom_125:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "zoom_in.png", NULL), NULL);
+ break;
+ case zoom_100:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "zoom_normal.png", NULL), NULL);
+ break;
+ case zoom_75:
+ case zoom_50:
+ case zoom_25:
+ ret = gdk_pixbuf_new_from_file(g_build_filename(gf_get_image_dir(), "conf", "zoom_out.png", NULL), NULL);
+ break;
+ default:
+ ret = NULL;
+ break;
+ }
+
+ return ret;
+}
+/**********************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_pngs.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,38 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#ifndef GF_PNGS_H
+#define GF_PNGS_H
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "guifications.h"
+/***********************************************************************
+ Prototypes
+***********************************************************************/
+gchar *gf_get_image_dir();
+GdkPixbuf *get_def_background_image();
+GdkPixbuf *get_clipping_image(gf_clip clip);
+GdkPixbuf *get_text_position_image(gf_tpos pos);
+GdkPixbuf *get_icon_position_image(gf_ipos pos);
+GdkPixbuf *get_icon_size_image(gf_icon_size size);
+GdkPixbuf *get_window_image(gf_gfpos pos);
+GdkPixbuf *get_zoom_image(gf_zoom zoom);
+/**********************************************************************/
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_prefs.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,85 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#include "prefs.h"
+#include "debug.h"
+
+#include "guifications.h"
+#include "gf_prefs.h"
+
+/**********************************************************************/
+void
+gf_add_prefs() {
+ /* add roots */
+ gaim_prefs_add_none(GF_PREF_ROOT);
+ gaim_prefs_add_none(GF_PREF_PLUGIN_ROOT);
+
+ /* add behavior tree */
+ gaim_prefs_add_none(GF_PREF_BEHAVIOR_ROOT);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_SIGN_ON, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_SIGN_OFF, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_AWAY, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_BACK, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_IDLE, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOW_UNIDLE, TRUE);
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_WINDOW_POS, gfpos_se);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_WINDOW_VERTICAL, TRUE);
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_TIMEOUT, 6);
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_ZOOM, zoom_100);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_ALIAS, TRUE);
+ gaim_prefs_add_bool(GF_PREF_BEHAVIOR_SHOWAWAY, TRUE); /* snakez */
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_MOUSE1, mouse_conversation);
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_MOUSE2, mouse_destroy);
+ gaim_prefs_add_int(GF_PREF_BEHAVIOR_MOUSE3, mouse_context);
+
+ /* add appearance tree */
+ gaim_prefs_add_none(GF_PREF_APPEARANCE_ROOT);
+ gaim_prefs_add_bool(GF_PREF_APPEARANCE_IMAGE, FALSE);
+ gaim_prefs_add_string(GF_PREF_APPEARANCE_IMAGE_FILE, "");
+ gaim_prefs_add_bool(GF_PREF_APPEARANCE_FONT, FALSE);
+ gaim_prefs_add_string(GF_PREF_APPEARANCE_FONT_FACE, "");
+ gaim_prefs_add_bool(GF_PREF_APPEARANCE_COLOR, FALSE);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_TEXT_POS, tpos_c);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_TEXT_CLIPPING, clip_elipse_middle);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_TEXT_X, 0);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_TEXT_Y, 0);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_PROT_POS, ipos_sw);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_PROT_SIZE, isize_small);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_PROT_X, 5);
+ gaim_prefs_add_int(GF_PREF_APPEARANCE_PROT_Y, 5);
+
+ /* add colors tree */
+ gaim_prefs_add_none(GF_PREF_COLORS_ROOT);
+ gaim_prefs_add_string(GF_PREF_COLORS_FOREGROUND, "#000000000000");
+
+ /* add messages tree */
+ gaim_prefs_add_none(GF_PREF_MESSAGES_ROOT);
+ gaim_prefs_add_string(GF_PREF_MESSAGES_SIGN_ON, "has signed on");
+ gaim_prefs_add_string(GF_PREF_MESSAGES_SIGN_OFF, "has signed off");
+ gaim_prefs_add_string(GF_PREF_MESSAGES_AWAY, "is now away");
+ gaim_prefs_add_string(GF_PREF_MESSAGES_BACK, "is now back");
+ gaim_prefs_add_string(GF_PREF_MESSAGES_IDLE, "is now idle");
+ gaim_prefs_add_string(GF_PREF_MESSAGES_UNIDLE, "is no longer idle");
+
+ /* add advanced tree */
+ gaim_prefs_add_none(GF_PREF_ADVANCED_ROOT);
+ gaim_prefs_add_int(GF_PREF_ADVANCED_DELAY, 7000);
+ gaim_prefs_add_bool(GF_PREF_ADVANCED_RELEASE, TRUE);
+ gaim_prefs_add_int(GF_PREF_ADVANCED_RELEASE_CHECK, 0);
+}
+/**********************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_prefs.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,76 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#ifndef GF_PREFS_H
+#define GF_PREFS_H
+
+/***********************************************************************
+ Globals
+***********************************************************************/
+#define GF_PREF_ROOT "/plugins/gtk/amc_grim"
+#define GF_PREF_PLUGIN_ROOT "/plugins/gtk/amc_grim/guifications"
+#define GF_PREF_BEHAVIOR_ROOT "/plugins/gtk/amc_grim/guifications/behavior"
+#define GF_PREF_BEHAVIOR_SHOW_SIGN_ON "/plugins/gtk/amc_grim/guifications/behavior/signon"
+#define GF_PREF_BEHAVIOR_SHOW_SIGN_OFF "/plugins/gtk/amc_grim/guifications/behavior/signoff"
+#define GF_PREF_BEHAVIOR_SHOW_AWAY "/plugins/gtk/amc_grim/guifications/behavior/away"
+#define GF_PREF_BEHAVIOR_SHOW_BACK "/plugins/gtk/amc_grim/guifications/behavior/back"
+#define GF_PREF_BEHAVIOR_SHOW_IDLE "/plugins/gtk/amc_grim/guifications/behavior/idle"
+#define GF_PREF_BEHAVIOR_SHOW_UNIDLE "/plugins/gtk/amc_grim/guifications/behavior/unidle"
+#define GF_PREF_BEHAVIOR_WINDOW_POS "/plugins/gtk/amc_grim/guifications/behavior/pos"
+#define GF_PREF_BEHAVIOR_WINDOW_VERTICAL "/plugins/gtk/amc_grim/guifications/behavior/vertical"
+#define GF_PREF_BEHAVIOR_TIMEOUT "/plugins/gtk/amc_grim/guifications/behavior/timeout"
+#define GF_PREF_BEHAVIOR_ZOOM "/plugins/gtk/amc_grim/guifications/behavior/zoom"
+#define GF_PREF_BEHAVIOR_ALIAS "/plugins/gtk/amc_grim/guifications/behavior/alias"
+#define GF_PREF_BEHAVIOR_SHOWAWAY "/plugins/gtk/amc_grim/guifications/behavior/showaway" /* snakez */
+#define GF_PREF_BEHAVIOR_MOUSE1 "/plugins/gtk/amc_grim/guifications/behavior/mouse1"
+#define GF_PREF_BEHAVIOR_MOUSE2 "/plugins/gtk/amc_grim/guifications/behavior/mouse2"
+#define GF_PREF_BEHAVIOR_MOUSE3 "/plugins/gtk/amc_grim/guifications/behavior/mouse3"
+#define GF_PREF_APPEARANCE_ROOT "/plugins/gtk/amc_grim/guifications/appearance"
+#define GF_PREF_APPEARANCE_IMAGE "/plugins/gtk/amc_grim/guifications/appearance/image"
+#define GF_PREF_APPEARANCE_IMAGE_FILE "/plugins/gtk/amc_grim/guifications/appearance/custom_image"
+#define GF_PREF_APPEARANCE_FONT "/plugins/gtk/amc_grim/guifications/appearance/font"
+#define GF_PREF_APPEARANCE_FONT_FACE "/plugins/gtk/amc_grim/guifications/appearance/face"
+#define GF_PREF_APPEARANCE_COLOR "/plugins/gtk/amc_grim/guifications/appearance/color"
+#define GF_PREF_APPEARANCE_TEXT_POS "/plugins/gtk/amc_grim/guifications/appearance/tpos"
+#define GF_PREF_APPEARANCE_TEXT_CLIPPING "/plugins/gtk/amc_grim/guifications/appearance/clip"
+#define GF_PREF_APPEARANCE_TEXT_X "/plugins/gtk/amc_grim/guifications/appearance/text_x"
+#define GF_PREF_APPEARANCE_TEXT_Y "/plugins/gtk/amc_grim/guifications/appearance/text_y"
+#define GF_PREF_APPEARANCE_PROT_POS "/plugins/gtk/amc_grim/guifications/appearance/ppos"
+#define GF_PREF_APPEARANCE_PROT_SIZE "/plugins/gtk/amc_grim/guifications/appearance/psize"
+#define GF_PREF_APPEARANCE_PROT_X "/plugins/gtk/amc_grim/guifications/appearance/prot_x"
+#define GF_PREF_APPEARANCE_PROT_Y "/plugins/gtk/amc_grim/guifications/appearance/prot_y"
+#define GF_PREF_COLORS_ROOT "/plugins/gtk/amc_grim/guifications/colors"
+#define GF_PREF_COLORS_FOREGROUND "/plugins/gtk/amc_grim/guifications/colors/foreground"
+#define GF_PREF_MESSAGES_ROOT "/plugins/gtk/amc_grim/guifications/messages"
+#define GF_PREF_MESSAGES_SIGN_ON "/plugins/gtk/amc_grim/guifications/messages/signon"
+#define GF_PREF_MESSAGES_SIGN_OFF "/plugins/gtk/amc_grim/guifications/messages/signoff"
+#define GF_PREF_MESSAGES_AWAY "/plugins/gtk/amc_grim/guifications/messages/away"
+#define GF_PREF_MESSAGES_BACK "/plugins/gtk/amc_grim/guifications/messages/back"
+#define GF_PREF_MESSAGES_IDLE "/plugins/gtk/amc_grim/guifications/messages/idle"
+#define GF_PREF_MESSAGES_UNIDLE "/plugins/gtk/amc_grim/guifications/messages/unidle"
+#define GF_PREF_ADVANCED_ROOT "/plugins/gtk/amc_grim/guifications/advanced"
+#define GF_PREF_ADVANCED_DELAY "/plugins/gtk/amc_grim/guifications/advanced/delay"
+#define GF_PREF_ADVANCED_RELEASE "/plugins/gtk/amc_grim/guifications/advanced/release_notification"
+#define GF_PREF_ADVANCED_RELEASE_CHECK "/plugins/gtk/amc_grim/guifications/advanced/release_check"
+/***********************************************************************
+ prototypes
+***********************************************************************/
+void gf_add_prefs();
+/**********************************************************************/
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_theme.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,51 @@
+#ifndef GF_THEME_H
+#define GF_THEME_H
+
+typedef enum _gf_theme_type {
+ gf_theme_type_basic = 0,
+ gf_theme_type_advanced
+} gf_theme_type;
+
+typedef enum _gf_theme_info {
+ gf_theme_info_name = 0,
+ gf_theme_info_version,
+ gf_theme_info_description,
+ gf_theme_info_author,
+ gf_theme_info_website
+} gf_theme_info;
+
+typedef struct _gf_basic_theme {
+ gchar *image;
+
+ gboolean text_custom_font;
+ gchar *text_font;
+ gboolean text_custom_color;
+ gchar *text_color;
+ gint text_clipping;
+ gint text_position;
+ gint text_horz_offset;
+ gint text_vert_offset;
+
+ gint proto_position;
+ gint proto_size;
+ gint proto_horz_offset;
+ gint proto_vert_offset;
+
+ gchar *messages[6];
+} gf_basic_theme;
+
+typedef struct _gf_advanced_theme {
+
+} gf_advanced_theme;
+
+typedef struct _gf_theme {
+ gf_theme_type type;
+ gchar *info[5];
+
+ union {
+ gf_basic_theme basic;
+ gf_advanced_theme advanced;
+ } data;
+} gf_theme;
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_theme_editor.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,1339 @@
+#include <stdio.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "xmlnode.h"
+
+#include "guifications.h"
+#include "gf_pngs.h"
+#include "gf_theme.h"
+#include "grimdirtreeview.h"
+/***********************************************************************
+ * Globals
+ **********************************************************************/
+#define base_title "Guifications Theme Editor"
+GtkWidget *window;
+gf_theme theme;
+gboolean theme_modified = FALSE;
+gchar *file_name;
+/* info globals */
+GtkWidget *theme_name, *theme_version, *theme_description;
+GtkWidget *theme_author, *theme_website;
+/* basic globals */
+GtkWidget *basic_image_file, *basic_image_button;
+GtkWidget *basic_text_font_check, *basic_text_font_button;
+GtkWidget *basic_text_color_check, *basic_text_color_button;
+GtkWidget *basic_text_clipping_menu, *basic_text_pos_menu;
+GtkWidget *basic_text_horz_offset, *basic_text_vert_offset;
+GtkWidget *basic_proto_pos_menu, *basic_proto_size_menu;
+GtkWidget *basic_proto_horz_offset, *basic_proto_vert_offset;
+GtkWidget *basic_message_signon, *basic_message_signoff;
+GtkWidget *basic_message_away, *basic_message_back;
+GtkWidget *basic_message_idle, *basic_message_unidle;
+/* preview globals */
+GtkWidget *preview_menu, *preview_image;
+/***********************************************************************
+ * Prototypes
+ **********************************************************************/
+gint main(gint argc, gchar *argv[]);
+
+static GtkWidget *make_window();
+static void make_info_page(GtkWidget *notebook);
+static void make_basic_page(GtkWidget *notebook);
+static void make_messages_page(GtkWidget *notebook);
+static void make_advanced_page(GtkWidget *notebook);
+
+static void clear_theme();
+static void update_controls();
+static void update_modified(gboolean modified);
+
+/* helpers */
+static GtkWidget *make_label(gchar *text, GtkSizeGroup *sg);
+static GtkWidget *make_spin_button();
+static GtkWidget *make_frame(GtkWidget *parent, const gchar *title);
+static GtkWidget *make_preview_menu();
+static GtkWidget *make_check_button(const gchar *text, GtkSizeGroup *sg);
+static GtkWidget *make_clip_option_menu();
+static GtkWidget *make_clip_menu_item(gf_clip clip);
+static GtkWidget *make_text_pos_option_menu();
+static GtkWidget *make_text_pos_menu_item(gf_tpos pos);
+static GtkWidget *make_icon_pos_option_menu();
+static GtkWidget *make_icon_pos_menu_item(gf_ipos pos);
+static GtkWidget *make_icon_size_option_menu();
+static GtkWidget *make_icon_size_menu_item(gf_icon_size isize);
+static GtkWidget *make_file_dialog(gchar *title, gboolean open, gboolean quit);
+
+/* Callbacks */
+static gboolean close_editor(GtkWidget *widget, GdkEvent *event, gpointer data);
+static void menu_new_cb();
+static void menu_open_cb();
+static void menu_save_cb();
+static void menu_save_as_cb();
+static void menu_quit_cb();
+static void menu_debug_theme_dump_cb();
+static void preview_option_cb(GtkWidget *widget, gpointer data);
+static gboolean entry_cb(GtkWidget *widget, gpointer data);
+static void spin_button_cb(GtkWidget *widget, gpointer data);
+static void check_button_cb(GtkWidget *widget, gpointer data);
+static void option_menu_cb(GtkWidget *widget, gpointer data);
+static void image_file_dialog(GtkWidget *widget, gpointer data);
+static void image_file_dialog_ok(GtkWidget *widget, gpointer data);
+static void font_dialog(GtkWidget *widget, gpointer data);
+static void font_dialog_ok(GtkWidget *widget, gpointer data);
+static void color_dialog(GtkWidget *widget, gpointer data);
+static void color_dialog_ok(GtkWidget *widget, gpointer data);
+static void modified_message_response_cb(GtkWidget *widget, gint response_id, gpointer data);
+static void file_dialog_ok(GtkWidget *widget, gpointer data);
+/***********************************************************************
+ * Menu
+ **********************************************************************/
+static GtkItemFactoryEntry main_menu[] = {
+ /* filemenu */
+ { "/_File", NULL, NULL, 0, "<Branch>" },
+ { "/File/_New", "<CTL>N", menu_new_cb, 0, "<StockItem>", GTK_STOCK_NEW },
+ { "/File/_Open...", "<CTL>O", menu_open_cb, 0, "<StockItem>", GTK_STOCK_OPEN },
+ { "/File/_Save", "<CTL>S", menu_save_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
+ { "/File/Save _As...", NULL, menu_save_as_cb, 0, "<StockItem>", GTK_STOCK_SAVE_AS },
+ { "/File/sep", NULL, NULL, 0, "<Separator>" },
+ { "/File/_Refresh Preview", "F5", NULL, 0, "<StockItem>", GTK_STOCK_REFRESH },
+ { "/File/sep1", NULL, NULL, 0, "<Separator>" },
+ { "/File/_Quit", "<CTL>Q", menu_quit_cb, 0, "<StockItem>", GTK_STOCK_QUIT },
+ { "/_Debug", NULL, NULL, 0, "<Branch>" },
+ { "/Debug/_Dump Theme", "<CTL>D", menu_debug_theme_dump_cb, 0, NULL },
+};
+/***********************************************************************
+ * Functions
+ **********************************************************************/
+gint
+main(gint argc, gchar *argv[]) {
+ gtk_init(&argc, &argv);
+
+ file_name = NULL;
+
+ window = make_window();
+ clear_theme();
+ update_controls();
+
+ gtk_main();
+ return 0;
+}
+/***********************************************************************
+ * Helpers
+ **********************************************************************/
+static GtkWidget *
+make_window() {
+ GtkWidget *win, *vbox, *hbox, *note, *frame;
+ GtkItemFactory *menubar;
+
+ win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(win), base_title);
+ gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
+ g_signal_connect(G_OBJECT(win), "delete_event", G_CALLBACK(close_editor), NULL);
+
+ /* create main vbox */
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(win), vbox);
+
+ /* create and pack the menubar */
+ menubar = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<ThemeMain>", NULL);
+ gtk_item_factory_create_items(menubar, sizeof(main_menu) / sizeof(*main_menu), main_menu, NULL);
+ gtk_box_pack_start(GTK_BOX(vbox), gtk_item_factory_get_widget(menubar, "<ThemeMain>"), FALSE, FALSE, 0);
+
+ /* create and pack main hbox */
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
+
+ /* create and pack the notebook */
+ note = gtk_notebook_new();
+ gtk_box_pack_start(GTK_BOX(hbox), note, TRUE, TRUE, 0);
+
+ /* create and add pages */
+ make_info_page(note);
+ make_basic_page(note);
+ make_messages_page(note);
+ make_advanced_page(note);
+
+ /* create and pack preview vbox */
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 4);
+
+ /* create preview frame */
+ frame = make_frame(vbox, "Preview");
+ gtk_container_set_border_width(GTK_CONTAINER(frame), 12);
+
+ /* create and pack preview option menu */
+ preview_menu = make_preview_menu();
+ g_signal_connect(G_OBJECT(preview_menu), "changed", G_CALLBACK(preview_option_cb), NULL);
+ gtk_box_pack_start(GTK_BOX(frame), preview_menu, FALSE, FALSE, 0);
+
+ /* show all widgets and return the window */
+ gtk_widget_show_all(win);
+
+ return win;
+}
+/**********************************************************************/
+static void
+make_info_page(GtkWidget *notebook) {
+ GtkWidget *vbox, *hbox, *label, *frame;
+ GtkSizeGroup *sg;
+
+ label = gtk_label_new("Information");
+ vbox = gtk_vbox_new(FALSE, 4);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), vbox, label, -1);
+
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* create and pack frame */
+ frame = make_frame(vbox, "Theme Information");
+
+ /* create and pack name line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Name:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ theme_name = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), theme_name);
+ g_signal_connect(G_OBJECT(theme_name), "changed", G_CALLBACK(entry_cb), &theme.info[0]);
+ gtk_box_pack_start(GTK_BOX(hbox), theme_name, FALSE, FALSE, 0);
+
+ /* create and pack version line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Version:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ theme_version = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), theme_version);
+ g_signal_connect(G_OBJECT(theme_version), "changed", G_CALLBACK(entry_cb), &theme.info[1]);
+ gtk_box_pack_start(GTK_BOX(hbox), theme_version, FALSE, FALSE, 0);
+
+ /* create and pack description line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Description:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ theme_description = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), theme_description);
+ g_signal_connect(G_OBJECT(theme_description), "changed", G_CALLBACK(entry_cb), &theme.info[2]);
+ gtk_box_pack_start(GTK_BOX(hbox), theme_description, FALSE, FALSE, 0);
+
+ /* create and pack author line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Author:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ theme_author = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), theme_author);
+ g_signal_connect(G_OBJECT(theme_author), "changed", G_CALLBACK(entry_cb), &theme.info[3]);
+ gtk_box_pack_start(GTK_BOX(hbox), theme_author, FALSE, FALSE, 0);
+
+ /* create and pack website list */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Website:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ theme_website = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), theme_website);
+ g_signal_connect(G_OBJECT(theme_website), "changed", G_CALLBACK(entry_cb), &theme.info[4]);
+ gtk_box_pack_start(GTK_BOX(hbox), theme_website, FALSE, FALSE, 0);
+
+ /* free the sizegroup */
+ g_object_unref(sg);
+}
+/**********************************************************************/
+static void
+make_basic_page(GtkWidget *notebook) {
+ GtkWidget *vbox, *hbox, *frame, *label;
+ GtkSizeGroup *sg;
+
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ label = gtk_label_new("Basic Theme");
+ vbox = gtk_vbox_new(FALSE, 4);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), vbox, label, -1);
+
+ /* create and pack image frame */
+ frame = make_frame(vbox, "Image");
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, TRUE, TRUE, 0);
+
+ basic_image_file = gtk_entry_new();
+ gtk_widget_set_sensitive(basic_image_file, FALSE);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_image_file, TRUE, TRUE, 0);
+
+ basic_image_button = gtk_button_new_with_mnemonic("_Browse");
+ g_signal_connect(G_OBJECT(basic_image_button), "clicked", G_CALLBACK(image_file_dialog), &theme.data.basic.image);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_image_button, FALSE, FALSE, 0);
+
+ /* create and pack text frame */
+ frame = make_frame(vbox, "Text");
+
+ /* create and pack font line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ basic_text_font_check = make_check_button("Use custom fon_t", sg);
+ g_signal_connect(G_OBJECT(basic_text_font_check), "clicked", G_CALLBACK(check_button_cb), &theme.data.basic.text_custom_font);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_font_check, FALSE, FALSE, 0);
+
+ basic_text_font_button = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT);
+ g_signal_connect(G_OBJECT(basic_text_font_button), "clicked", G_CALLBACK(font_dialog), &theme.data.basic.text_font);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_font_button, FALSE, FALSE, 0);
+
+ /* create and pack color line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ basic_text_color_check = make_check_button("Use custom co_lor", sg);
+ g_signal_connect(G_OBJECT(basic_text_color_check), "clicked", G_CALLBACK(check_button_cb), &theme.data.basic.text_custom_color);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_color_check, FALSE, FALSE, 0);
+
+ basic_text_color_button = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR);
+ g_signal_connect(G_OBJECT(basic_text_color_button), "clicked", G_CALLBACK(color_dialog), &theme.data.basic.text_color);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_color_button, FALSE, FALSE, 0);
+
+ /* create and pack clipping line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("Clippin_g:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_text_clipping_menu = make_clip_option_menu();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_text_clipping_menu);
+ g_signal_connect(G_OBJECT(basic_text_clipping_menu), "changed", G_CALLBACK(option_menu_cb), &theme.data.basic.text_clipping);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_clipping_menu, FALSE, FALSE, 0);
+
+ /* create and pack text position line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Position:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_text_pos_menu = make_text_pos_option_menu();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_text_pos_menu);
+ g_signal_connect(G_OBJECT(basic_text_pos_menu), "changed", G_CALLBACK(option_menu_cb), &theme.data.basic.text_position);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_pos_menu, FALSE, FALSE, 0);
+
+ /* create and pack horizontal offset line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Horizontal offset:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_text_horz_offset = make_spin_button();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_text_horz_offset);
+ g_signal_connect(G_OBJECT(basic_text_horz_offset), "changed", G_CALLBACK(spin_button_cb), &theme.data.basic.text_horz_offset);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_horz_offset, FALSE, FALSE, 0);
+
+ /* create and pack vertical offset line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Vertical offset:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_text_vert_offset = make_spin_button();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_text_vert_offset);
+ g_signal_connect(G_OBJECT(basic_text_vert_offset), "changed", G_CALLBACK(spin_button_cb), &theme.data.basic.text_vert_offset);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_text_vert_offset, FALSE, FALSE, 0);
+
+ /* create and pack protocol frame */
+ frame = make_frame(vbox, "Protocol Icon");
+
+ /* create and pack protocol position line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("P_osition:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_proto_pos_menu = make_icon_pos_option_menu();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_proto_pos_menu);
+ g_signal_connect(G_OBJECT(basic_proto_pos_menu), "changed", G_CALLBACK(option_menu_cb), &theme.data.basic.proto_position);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_proto_pos_menu, FALSE, FALSE, 0);
+
+ /* create and pack protocol size line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("Si_ze:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_proto_size_menu = make_icon_size_option_menu();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_proto_size_menu);
+ g_signal_connect(G_OBJECT(basic_proto_size_menu), "changed", G_CALLBACK(option_menu_cb), &theme.data.basic.proto_size);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_proto_size_menu, FALSE, FALSE, 0);
+
+ /* create and pack protocol horizontal offset line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("Ho_rizontal offset:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_proto_horz_offset = make_spin_button();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_proto_horz_offset);
+ g_signal_connect(G_OBJECT(basic_proto_horz_offset), "changed", G_CALLBACK(spin_button_cb), &theme.data.basic.proto_horz_offset);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_proto_horz_offset, FALSE, FALSE, 0);
+
+ /* create and pack protocol vertical offset line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("Ver_tical offset:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_proto_vert_offset = make_spin_button();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_proto_vert_offset);
+ g_signal_connect(G_OBJECT(basic_proto_vert_offset), "changed", G_CALLBACK(spin_button_cb), &theme.data.basic.proto_vert_offset);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_proto_vert_offset, FALSE, FALSE, 0);
+
+ /* free the sizegroup */
+ g_object_unref(sg);
+}
+/**********************************************************************/
+static void
+make_messages_page(GtkWidget *notebook) {
+ GtkWidget *vbox, *hbox, *label, *frame;
+ GtkSizeGroup *sg;
+
+ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ label = gtk_label_new("Messages");
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), vbox, label, -1);
+
+ /* create and pack frame */
+ frame = make_frame(vbox, "Status Messages");
+
+ /* create and pack sign on line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Sign On:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_signon = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_signon);
+ g_signal_connect(G_OBJECT(basic_message_signon), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[0]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_signon, FALSE, FALSE, 0);
+
+ /* create and pack sign off line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("Sign _Off:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_signoff = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_signoff);
+ g_signal_connect(G_OBJECT(basic_message_signoff), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[1]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_signoff, FALSE, FALSE, 0);
+
+ /* create and pack away line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Away:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_away = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_away);
+ g_signal_connect(G_OBJECT(basic_message_away), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[2]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_away, FALSE, FALSE, 0);
+
+ /* create and pack back line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Back:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_back = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_back);
+ g_signal_connect(G_OBJECT(basic_message_back), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[3]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_back, FALSE, FALSE, 0);
+
+ /* create and pack idle line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Idle:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_idle = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_idle);
+ g_signal_connect(G_OBJECT(basic_message_idle), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[4]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_idle, FALSE, FALSE, 0);
+
+ /* create and pack unidle line */
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0);
+
+ label = make_label("_Unidle:", sg);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ basic_message_unidle = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), basic_message_unidle);
+ g_signal_connect(G_OBJECT(basic_message_unidle), "changed", G_CALLBACK(entry_cb), &theme.data.basic.messages[5]);
+ gtk_box_pack_start(GTK_BOX(hbox), basic_message_unidle, FALSE, FALSE, 0);
+
+ /* free sizegroup */
+ g_object_unref(sg);
+}
+/**********************************************************************/
+static void
+moved_cursor(GrimDirTreeView *dir_tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) {
+ gtk_window_set_title(GTK_WINDOW(window), grim_dir_tree_view_get_path(dir_tree_view));
+
+ printf("path=%s\n", gtk_tree_path_to_string(path));
+}
+
+static void
+make_advanced_page(GtkWidget *notebook) {
+ GtkWidget *vbox, *label, *scrolled_window, *dir_tree_view;
+
+ label = gtk_label_new("Advanced Theme");
+ vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), vbox, label, -1);
+
+ scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
+
+ dir_tree_view = grim_dir_tree_view_new();
+ g_signal_connect(G_OBJECT(dir_tree_view), "row-activated", G_CALLBACK(moved_cursor), NULL);
+ gtk_container_add(GTK_CONTAINER(scrolled_window), dir_tree_view);
+ grim_dir_tree_view_set_path(GRIM_DIR_TREE_VIEW(dir_tree_view), g_get_home_dir());
+}
+/**********************************************************************/
+static GtkWidget *
+make_label(gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *label;
+
+ label = gtk_label_new_with_mnemonic(text);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
+
+ if (sg)
+ gtk_size_group_add_widget(sg, label);
+
+ return label;
+}
+/**********************************************************************/
+static GtkWidget *
+make_frame(GtkWidget *parent, const gchar *title) {
+ GtkWidget *vbox, *hbox, *label;
+ gchar *fmt_title;
+
+ fmt_title = g_strdup_printf("<span weight=\"bold\">%s</span>", title);
+
+ vbox = gtk_vbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(parent), vbox, FALSE, FALSE, 0);
+ gtk_widget_show(vbox);
+
+ label = gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), fmt_title);
+ g_free(fmt_title);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show(label);
+
+ hbox = gtk_hbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show(hbox);
+
+ label = gtk_label_new(" ");
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show(label);
+
+ vbox = gtk_vbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show(vbox);
+
+ return vbox;
+}
+/**********************************************************************/
+static GtkWidget *
+make_preview_menu() {
+ GtkWidget *option_menu, *menu, *item;
+
+ menu = gtk_menu_new();
+
+ item = gtk_menu_item_new_with_label("Custom");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Sign On");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Sign Off");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Away");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Back");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Idle");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ item = gtk_menu_item_new_with_label("Unidle");
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ gtk_widget_show_all(menu);
+
+ option_menu = gtk_option_menu_new();
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+
+ return option_menu;
+}
+/**********************************************************************/
+static GtkWidget *
+make_check_button(const gchar *text, GtkSizeGroup *sg) {
+ GtkWidget *check;
+
+ check = gtk_check_button_new_with_mnemonic(text);
+
+ if (sg)
+ gtk_size_group_add_widget(sg, check);
+
+ return check;
+}
+/**********************************************************************/
+static GtkWidget *
+make_clip_option_menu() {
+ GtkWidget *option_menu, *menu;
+ gint i;
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 4; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_clip_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+
+ return option_menu;
+}
+/**********************************************************************/
+static GtkWidget *
+make_clip_menu_item(gf_clip clip) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_clipping_image(clip);
+
+ switch (clip)
+ {
+ case clip_truncate: label = gtk_label_new("Truncate"); break;
+ case clip_elipse_start: label = gtk_label_new("Elipse at the beginning"); break;
+ case clip_elipse_middle: label = gtk_label_new("Elipse in the middle"); break;
+ case clip_elipse_end: label = gtk_label_new("Elipse at the end"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_text_pos_option_menu() {
+ GtkWidget *option_menu, *menu;
+ gint i;
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 9; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_text_pos_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+
+ return option_menu;
+}
+/**********************************************************************/
+static GtkWidget *
+make_text_pos_menu_item(gf_tpos pos) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_text_position_image(pos);
+
+ switch (pos)
+ {
+ case tpos_nw: label = gtk_label_new("Top Left"); break;
+ case tpos_n: label = gtk_label_new("Top"); break;
+ case tpos_ne: label = gtk_label_new("Top Right"); break;
+ case tpos_w: label = gtk_label_new("Left"); break;
+ case tpos_c: label = gtk_label_new("Center"); break;
+ case tpos_e: label = gtk_label_new("Right"); break;
+ case tpos_sw: label = gtk_label_new("Bottom Left"); break;
+ case tpos_s: label = gtk_label_new("Bottom"); break;
+ case tpos_se: label = gtk_label_new("Bottom Right"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_spin_button() {
+ GtkWidget *spin;
+ GtkObject *adj;
+
+ adj = gtk_adjustment_new(0, 0, 255, 1, 10, 10);
+
+ spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spin), TRUE);
+
+ return spin;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_pos_option_menu() {
+ GtkWidget *option_menu, *menu;
+ gint i;
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 10; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_icon_pos_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+
+ return option_menu;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_pos_menu_item(gf_ipos pos) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_icon_position_image(pos);
+
+ switch (pos)
+ {
+ case ipos_none: label = gtk_label_new("None"); break;
+ case ipos_nw: label = gtk_label_new("Top Left"); break;
+ case ipos_n: label = gtk_label_new("Top"); break;
+ case ipos_ne: label = gtk_label_new("Top Right"); break;
+ case ipos_w: label = gtk_label_new("Left"); break;
+ case ipos_c: label = gtk_label_new("Center"); break;
+ case ipos_e: label = gtk_label_new("Right"); break;
+ case ipos_sw: label = gtk_label_new("Bottom Left"); break;
+ case ipos_s: label = gtk_label_new("Bottom"); break;
+ case ipos_se: label = gtk_label_new("Bottom Right"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_size_option_menu() {
+ GtkWidget *option_menu, *menu;
+ gint i;
+
+ option_menu = gtk_option_menu_new();
+ menu = gtk_menu_new();
+
+ for (i = 0; i < 5; i++)
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), make_icon_size_menu_item(i));
+
+ gtk_widget_show_all(menu);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
+
+ return option_menu;
+}
+/**********************************************************************/
+static GtkWidget *
+make_icon_size_menu_item(gf_icon_size isize) {
+ GtkWidget *item, *hbox, *label = NULL, *image;
+ GdkPixbuf *pixbuf = NULL;
+
+ item = gtk_menu_item_new();
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ pixbuf = get_icon_size_image(isize);
+
+ switch (isize)
+ {
+ case isize_tiny: label = gtk_label_new("Tiny (16x16)"); break;
+ case isize_small: label = gtk_label_new("Small (24x24)"); break;
+ case isize_normal: label = gtk_label_new("Normal (48x48)"); break;
+ case isize_large: label = gtk_label_new("Large (96x96)"); break;
+ case isize_huge: label = gtk_label_new("Huge (144x144)"); break;
+ }
+
+ image = gtk_image_new_from_pixbuf(pixbuf);
+
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+ return item;
+}
+/**********************************************************************/
+static void
+clear_theme() {
+ gint i;
+
+ theme.type = gf_theme_type_basic;
+
+ /* clear info */
+ for (i = 0; i < 5; i++) {
+ if (theme.info[i] != NULL)
+ g_free(theme.info[i]);
+ theme.info[i] = NULL;
+ }
+
+ /* clear basic theme */
+ if (theme.data.basic.image != NULL)
+ g_free(theme.data.basic.image);
+ theme.data.basic.image = NULL;
+
+ theme.data.basic.text_custom_font = FALSE;
+ if (theme.data.basic.text_font != NULL)
+ g_free(theme.data.basic.text_font);
+ theme.data.basic.text_font = NULL;
+
+ theme.data.basic.text_custom_color = FALSE;
+ if (theme.data.basic.text_color != NULL)
+ g_free(theme.data.basic.text_color);
+ theme.data.basic.text_color = NULL;
+
+ theme.data.basic.text_clipping = 0;
+ theme.data.basic.text_position = 0;
+ theme.data.basic.text_horz_offset = 0;
+ theme.data.basic.text_vert_offset = 0;
+
+ theme.data.basic.proto_position = 0;
+ theme.data.basic.proto_size = 0;
+ theme.data.basic.proto_horz_offset = 0;
+ theme.data.basic.proto_vert_offset = 0;
+
+ /* clear basic messages */
+ for (i = 0; i < 6; i++) {
+ if (theme.data.basic.messages[i] != NULL)
+ g_free(theme.data.basic.messages[i]);
+ theme.data.basic.messages[i] = NULL;
+ }
+}
+/**********************************************************************/
+static void
+update_controls() {
+ if (window != NULL) {
+ /* info tab */
+ if (theme.info[0] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(theme_name), theme.info[0]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(theme_name), "");
+ if (theme.info[1] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(theme_version), theme.info[1]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(theme_version), "");
+ if (theme.info[2] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(theme_description), theme.info[2]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(theme_description), "");
+ if (theme.info[3] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(theme_author), theme.info[3]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(theme_author), "");
+ if (theme.info[4] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(theme_website), theme.info[4]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(theme_website), "");
+
+ /* basic tab */
+ if (theme.data.basic.image != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_image_file), theme.data.basic.image);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_image_file), "");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(basic_text_font_check), theme.data.basic.text_custom_font);
+ gtk_widget_set_sensitive(basic_text_font_button, theme.data.basic.text_custom_font);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(basic_text_color_check), theme.data.basic.text_custom_color);
+ gtk_widget_set_sensitive(basic_text_color_button, theme.data.basic.text_custom_color);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(basic_text_clipping_menu), theme.data.basic.text_clipping);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(basic_text_pos_menu), theme.data.basic.text_position);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(basic_text_horz_offset), theme.data.basic.text_horz_offset);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(basic_text_vert_offset), theme.data.basic.text_vert_offset);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(basic_proto_pos_menu), theme.data.basic.proto_position);
+ gtk_option_menu_set_history(GTK_OPTION_MENU(basic_proto_size_menu), theme.data.basic.proto_size);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(basic_proto_horz_offset), theme.data.basic.proto_horz_offset);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(basic_proto_vert_offset), theme.data.basic.proto_vert_offset);
+
+ /* messages tab */
+ if (theme.data.basic.messages[0] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_signon), theme.data.basic.messages[0]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_signon), "");
+ if (theme.data.basic.messages[1] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_signoff), theme.data.basic.messages[1]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_signoff), "");
+ if (theme.data.basic.messages[2] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_away), theme.data.basic.messages[2]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_away), "");
+ if (theme.data.basic.messages[3] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_back), theme.data.basic.messages[3]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_back), "");
+ if (theme.data.basic.messages[4] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_idle), theme.data.basic.messages[4]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_idle), "");
+ if (theme.data.basic.messages[5] != NULL)
+ gtk_entry_set_text(GTK_ENTRY(basic_message_unidle), theme.data.basic.messages[5]);
+ else
+ gtk_entry_set_text(GTK_ENTRY(basic_message_unidle), "");
+ }
+}
+/**********************************************************************/
+static void
+update_modified(gboolean modified) {
+ gchar *title;
+
+ title = g_strdup_printf("%s %s", base_title, (modified) ? "(Modified)" : "(Saved)");
+
+ theme_modified = modified;
+
+ gtk_window_set_title(GTK_WINDOW(window), title);
+ g_free(title);
+}
+/**********************************************************************/
+static GtkWidget *
+make_file_dialog(gchar *title, gboolean open, gboolean quit) {
+ GtkWidget *dialog;
+
+ dialog = gtk_file_selection_new(title);
+
+ g_object_set_data(G_OBJECT(dialog), "open", (gpointer)open);
+ g_object_set_data(G_OBJECT(dialog), "quit", (gpointer)quit);
+
+ g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), "clicked", G_CALLBACK(file_dialog_ok), (gpointer)dialog);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+
+ return dialog;
+}
+/***********************************************************************
+ * Callbacks
+ *********************************************************************/
+static gboolean
+close_editor(GtkWidget *widget, GdkEvent *event, gpointer data) {
+ gtk_widget_destroy(window);
+ window = NULL;
+
+ gtk_main_quit();
+
+ return FALSE;
+}
+/**********************************************************************/
+static void
+menu_new_cb() {
+ GtkWidget *dialog = NULL;
+
+ if (!theme_modified) {
+ clear_theme();
+ update_controls();
+
+ if (file_name != NULL)
+ g_free(file_name);
+
+ file_name = NULL;
+ }
+ else {
+ dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "The theme has not been saved.\nWould you like to save it?");
+ g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(modified_message_response_cb), (gpointer)dialog);
+ gtk_widget_show(dialog);
+ }
+}
+/**********************************************************************/
+static void
+menu_open_cb() {
+ GtkWidget *dialog;
+
+ dialog = make_file_dialog("Open...", TRUE, FALSE);
+
+ gtk_widget_show(dialog);
+}
+/**********************************************************************/
+static void
+menu_save_cb() {
+ if (file_name == NULL)
+ menu_save_as_cb();
+ else {
+ printf("Write save file code here....\n");
+ }
+}
+/**********************************************************************/
+static void
+menu_save_as_cb() {
+ GtkWidget *dialog;
+
+ dialog = make_file_dialog("Save As...", FALSE, FALSE);
+
+ gtk_widget_show(dialog);
+}
+/**********************************************************************/
+static void
+menu_quit_cb() {
+ GtkWidget *dialog = NULL;
+
+ if (!theme_modified) {
+ gtk_widget_destroy(window);
+ window = NULL;
+
+ gtk_main_quit();
+ }
+ else {
+ dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "The theme has not been saved.\nWould you like to save it?");
+ g_object_set_data(G_OBJECT(dialog), "quit", (gpointer)TRUE);
+ g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(modified_message_response_cb), (gpointer)dialog);
+ gtk_widget_show(dialog);
+ }
+}
+/**********************************************************************/
+static void
+menu_debug_theme_dump_cb() {
+ printf(" ********************\n");
+ printf(" * THEME DUMP START\n");
+ printf("**********************\n");
+ printf("* Type:\t\t\t%d\n", theme.type);
+ printf("* \n");
+ printf("* Name:\t\t\t%s\n", theme.info[0]);
+ printf("* Version:\t\t%s\n", theme.info[1]);
+ printf("* Description:\t\t%s\n", theme.info[2]);
+ printf("* Author:\t\t%s\n", theme.info[3]);
+ printf("* Website:\t\t%s\n", theme.info[4]);
+
+ if (theme.type == gf_theme_type_basic) {
+ printf("*\n");
+ printf("* Basic:\n");
+ printf("* Text:\n");
+ printf("* Image:\t\t%s\n", theme.data.basic.image);
+ printf("* Custom Font:\t%d\n", theme.data.basic.text_custom_font);
+ printf("* Font:\t\t%s\n", theme.data.basic.text_font);
+ printf("* Custom Color:\t%d\n", theme.data.basic.text_custom_color);
+ printf("* Color:\t\t%s\n", theme.data.basic.text_color);
+ printf("* Clipping:\t\t%d\n", theme.data.basic.text_clipping);
+ printf("* Position:\t\t%d\n", theme.data.basic.text_position);
+ printf("* Horz Offset:\t%d\n", theme.data.basic.text_horz_offset);
+ printf("* Vert Offset:\t%d\n", theme.data.basic.text_vert_offset);
+ printf("* Protocol:\n");
+ printf("* Position:\t\t%d\n", theme.data.basic.proto_position);
+ printf("* Size:\t\t%d\n", theme.data.basic.proto_size);
+ printf("* Horz Offset:\t%d\n", theme.data.basic.proto_horz_offset);
+ printf("* Vert Offset:\t%d\n", theme.data.basic.proto_vert_offset);
+ printf("*\n");
+ printf("* Messages:\n");
+ printf("* Signon:\t\t%s\n", theme.data.basic.messages[0]);
+ printf("* Signoff:\t\t%s\n", theme.data.basic.messages[1]);
+ printf("* Away:\t\t%s\n", theme.data.basic.messages[2]);
+ printf("* Back:\t\t%s\n", theme.data.basic.messages[3]);
+ printf("* Idle:\t\t%s\n", theme.data.basic.messages[4]);
+ printf("* Unidle:\t\t%s\n", theme.data.basic.messages[5]);
+ }
+
+ printf("**********************\n");
+ printf(" * THEME DUMP END\n");
+ printf(" ********************\n");
+}
+/**********************************************************************/
+static void
+preview_option_cb(GtkWidget *widget, gpointer data) {
+}
+/**********************************************************************/
+static gboolean
+entry_cb(GtkWidget *widget, gpointer data) {
+ gchar **value = (gchar**)data;
+
+ if ((*value) != NULL)
+ g_free((*value));
+
+ (*value) = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
+
+ update_modified(TRUE);
+
+ return FALSE;
+}
+/**********************************************************************/
+static void
+spin_button_cb(GtkWidget *widget, gpointer data) {
+ gint *value = (gint*)data;
+
+ (*value) = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+ update_modified(TRUE);
+}
+/**********************************************************************/
+static void
+check_button_cb(GtkWidget *widget, gpointer data) {
+ gboolean new_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ gboolean *value = (gboolean*)data;
+
+ if (value == &theme.data.basic.text_custom_font)
+ gtk_widget_set_sensitive(basic_text_font_button, new_value);
+ else if (value == &theme.data.basic.text_custom_color)
+ gtk_widget_set_sensitive(basic_text_color_button, new_value);
+
+ (*value) = new_value;
+
+ update_modified(TRUE);
+}
+/**********************************************************************/
+static void
+option_menu_cb(GtkWidget *widget, gpointer data) {
+ gint *value = (gint*)data;
+
+ (*value) = gtk_option_menu_get_history(GTK_OPTION_MENU(widget));
+
+ update_modified(TRUE);
+}
+/**********************************************************************/
+static void
+image_file_dialog(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog;
+ gchar **value = (gchar**)data;
+
+ dialog = gtk_file_selection_new(NULL);
+
+ g_object_set_data(G_OBJECT(dialog), "var_addr", value);
+
+ if ((*value) != NULL)
+ gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), (*value));
+
+ gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dialog));
+
+ g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), "clicked", G_CALLBACK(image_file_dialog_ok), (gpointer)dialog);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+ g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+
+ gtk_widget_show(dialog);
+}
+/**********************************************************************/
+static void
+image_file_dialog_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog = (GtkWidget*)data, *message_box = NULL;
+ gchar **value = (gchar**)g_object_get_data(G_OBJECT(dialog), "var_addr");
+ gchar *file = NULL;
+ GdkPixbuf *pixbuf;
+
+ if ((*value) != NULL)
+ g_free((*value));
+
+ file = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog)));
+
+ pixbuf = gdk_pixbuf_new_from_file(file, NULL);
+
+ if (pixbuf != NULL) {
+ (*value) = file;
+ g_object_unref(pixbuf);
+ gtk_entry_set_text(GTK_ENTRY(basic_image_file), file);
+ update_modified(TRUE);
+ }
+ else {
+ message_box = gtk_message_dialog_new(GTK_WINDOW(window), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "The file \"%s\" is not a valid image file", file);
+ gtk_window_set_modal(GTK_WINDOW(message_box), TRUE);
+ g_signal_connect_swapped(G_OBJECT(message_box), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(message_box));
+ gtk_widget_show(message_box);
+ }
+}
+/**********************************************************************/
+static void
+font_dialog(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog;
+ gchar **value = (gchar**)data;
+
+ dialog = gtk_font_selection_dialog_new("Select a font...");
+
+ g_object_set_data(G_OBJECT(dialog), "var_addr", value);
+
+ if ((*value) != NULL)
+ gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog), (*value));
+
+ gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog), "Guifications");
+
+ g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(dialog)->ok_button), "clicked", G_CALLBACK(font_dialog_ok), (gpointer)dialog);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_FONT_SELECTION_DIALOG(dialog)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+ g_signal_connect_swapped(G_OBJECT(GTK_FONT_SELECTION_DIALOG(dialog)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+
+ gtk_widget_show(dialog);
+}
+/**********************************************************************/
+static void
+font_dialog_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog = (GtkWidget*)data;
+ gchar **value = (gchar**)g_object_get_data(G_OBJECT(dialog), "var_addr");
+
+ if ((*value) != NULL)
+ g_free((*value));
+
+ (*value) = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog)));
+
+ update_modified(TRUE);
+}
+/**********************************************************************/
+static void
+color_dialog(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog;
+ gchar **value = (gchar**)data;
+ GdkColor gdk_color;
+ PangoColor pan_color;
+
+ dialog = gtk_color_selection_dialog_new("Select a color...");
+
+ g_object_set_data(G_OBJECT(dialog), "var_addr", value);
+
+ if ((*value) != NULL) {
+ pango_color_parse(&pan_color, (*value));
+ gdk_color.red = pan_color.red;
+ gdk_color.green = pan_color.green;
+ gdk_color.blue = pan_color.blue;
+
+ gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), &gdk_color);
+ }
+
+ g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->ok_button), "clicked", G_CALLBACK(color_dialog_ok), (gpointer)dialog);
+
+ g_signal_connect_swapped(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->ok_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+ g_signal_connect_swapped(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)dialog);
+
+ gtk_widget_show(dialog);
+}
+/**********************************************************************/
+static void
+color_dialog_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog = (GtkWidget*)data;
+ gchar **value = (gchar**)g_object_get_data(G_OBJECT(dialog), "var_addr");
+ GdkColor gdk_color;
+
+ if ((*value) != NULL)
+ g_free((*value));
+
+ gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), &gdk_color);
+
+ (*value) = g_strdup_printf("#%04x%04x%04x", gdk_color.red, gdk_color.green, gdk_color.blue);
+
+ update_modified(TRUE);
+}
+/**********************************************************************/
+static void
+modified_message_response_cb(GtkWidget *widget, gint response_id, gpointer data) {
+ GtkWidget *dialog = (GtkWidget*)data;
+ gboolean quit = (gboolean)g_object_get_data(G_OBJECT(dialog), "quit");
+
+ switch (response_id) {
+ case GTK_RESPONSE_YES:
+ break;
+ case GTK_RESPONSE_NO:
+ clear_theme();
+ update_controls();
+ theme_modified = FALSE;
+ gtk_window_set_title(GTK_WINDOW(window), base_title);
+ gtk_widget_destroy(dialog);
+
+ if (quit) {
+ gtk_widget_destroy(window);
+ window = NULL;
+
+ gtk_main_quit();
+ }
+
+ break;
+ }
+}
+/**********************************************************************/
+static void
+file_dialog_ok(GtkWidget *widget, gpointer data) {
+ GtkWidget *dialog = (GtkWidget*)data;
+ GtkWidget *overwrite_dialog = NULL;
+ gboolean open = (gboolean)g_object_get_data(G_OBJECT(dialog), "open");
+ gboolean quit = (gboolean)g_object_get_data(G_OBJECT(dialog), "quit");
+
+ printf("ok clicked\n");
+
+ if (open) {
+ gtk_widget_destroy(dialog);
+ dialog = NULL;
+ }
+ else {
+
+ }
+}
+/**********************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gf_utils.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,483 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <pango/pango.h>
+#include <string.h>
+
+#include "account.h"
+#include "blist.h"
+#include "gaim.h"
+#include "prefs.h"
+#include "prpl.h"
+#include "debug.h"
+
+#ifdef _WIN32
+#include "win32dep.h"
+#endif
+
+#include "gf_utils.h"
+#include "gf_prefs.h"
+
+/**********************************************************************/
+void
+gf_resize(GtkWidget *window, GtkWidget *box) {
+ if (window != NULL) {
+ gtk_window_resize(GTK_WINDOW(window), get_window_width(box), get_window_height(box));
+ gtk_window_move(GTK_WINDOW(window), get_window_x(window), get_window_y(window));
+ }
+}
+/**********************************************************************/
+gint
+get_window_x(GtkWidget *window) {
+ GtkRequisition req;
+
+ gtk_widget_size_request(window, &req);
+
+ switch(gaim_prefs_get_int(GF_PREF_BEHAVIOR_WINDOW_POS)) {
+ case gfpos_nw:
+ case gfpos_sw:
+ return 0;
+ case gfpos_ne:
+ case gfpos_se:
+ return gdk_screen_width() - req.width;
+ }
+ return 0;
+}
+/**********************************************************************/
+gint
+get_window_y(GtkWidget *window) {
+ GtkRequisition req;
+
+ gtk_widget_size_request(window, &req);
+
+ switch(gaim_prefs_get_int(GF_PREF_BEHAVIOR_WINDOW_POS)) {
+ case gfpos_ne:
+ case gfpos_nw:
+ return 0;
+ case gfpos_se:
+ case gfpos_sw:
+ return gdk_screen_height() - req.height;
+ }
+ return 0;
+}
+/**********************************************************************/
+gint
+get_window_width(GtkWidget *box) {
+ GtkWidget *child;
+ GtkRequisition req;
+ GList *children;
+ gint new_size = 0;
+
+ children = gtk_container_get_children(GTK_CONTAINER(box));
+
+ if (gaim_prefs_get_bool(GF_PREF_BEHAVIOR_WINDOW_VERTICAL)) {
+ child = children->data;
+
+ gtk_widget_size_request(child, &req);
+ return req.width;
+ }
+ else {
+ while (children) {
+ child = children->data;
+ children = children->next;
+
+ gtk_widget_size_request(child, &req);
+ new_size += req.width;
+ }
+ g_list_free(children);
+ return new_size;
+ }
+}
+/**********************************************************************/
+gint
+get_window_height(GtkWidget *box) {
+ GtkWidget *child;
+ GtkRequisition req;
+ GList *children;
+ gint new_size = 0;
+
+ children = gtk_container_get_children(GTK_CONTAINER(box));
+
+ if (gaim_prefs_get_bool(GF_PREF_BEHAVIOR_WINDOW_VERTICAL)) {
+ while (children) {
+ child = children->data;
+ children = children->next;
+
+ gtk_widget_size_request(child, &req);
+ new_size += req.height;
+ }
+ g_list_free(children);
+ return new_size;
+ }
+ else {
+ child = children->data;
+
+ gtk_widget_size_request(child, &req);
+ return req.height;
+ }
+}
+/**********************************************************************/
+void
+get_image_size(dimensions *image_size) {
+ GdkPixbuf *image = NULL;
+
+ if (gaim_prefs_get_bool(GF_PREF_APPEARANCE_IMAGE)) {
+ image = gdk_pixbuf_new_from_file(gaim_prefs_get_string(GF_PREF_APPEARANCE_IMAGE_FILE), NULL);
+ if (image == NULL) {
+ gaim_prefs_set_bool(GF_PREF_APPEARANCE_IMAGE, FALSE);
+ gaim_prefs_set_string(GF_PREF_APPEARANCE_IMAGE_FILE, "");
+ image_size->width = 140;
+ image_size->height = 120;
+ }
+ else {
+ image_size->width = gdk_pixbuf_get_width(image);
+ image_size->height = gdk_pixbuf_get_height(image);
+ g_object_unref(image);
+ }
+ }
+ else {
+ image_size->width = 140;
+ image_size->height = 120;
+ }
+}
+/**********************************************************************/
+void
+get_zoom_size(dimensions image_size, dimensions *zoom_size) {
+ gfloat width = 0, height = 0;
+ gfloat owidth = image_size.width, oheight = image_size.height;
+
+ switch(gaim_prefs_get_int(GF_PREF_BEHAVIOR_ZOOM)) {
+ case zoom_200:
+ width = owidth * 2.0f;
+ height = oheight * 2.0f;
+ break;
+ case zoom_175:
+ width = owidth * 1.75f;
+ height = oheight * 1.75f;
+ break;
+ case zoom_150:
+ width = owidth * 1.5f;
+ height = oheight * 1.5f;
+ break;
+ case zoom_125:
+ width = owidth * 1.25f;
+ height = oheight * 1.25f;
+ break;
+ case zoom_75:
+ width = owidth * 0.75f;
+ height = oheight * 0.75f;
+ break;
+ case zoom_50:
+ width = owidth * 0.5f;
+ height = oheight * 0.5f;
+ break;
+ case zoom_25:
+ width = owidth * 0.25f;
+ height = oheight * 0.25f;
+ break;
+ case zoom_100:
+ default:
+ width = owidth;
+ height = oheight;
+ }
+
+ zoom_size->width = width;
+ zoom_size->height = height;
+}
+/**********************************************************************/
+void
+clip_layout(PangoLayout **layout, gboolean use_color, const gchar *text_x, const gchar *text_color) {
+ PangoLayout *lay = (*layout), *elipse = NULL;
+ gboolean loop = TRUE;
+ const gchar *text = NULL;
+ gchar *new_text = NULL, *left_text = NULL, *right_text = NULL;
+ gint width = 0, ewidth = 0, offset = 0, mid = 0;
+ dimensions dim;
+
+ offset = gaim_prefs_get_int(text_x);
+ get_image_size(&dim);
+
+ elipse = pango_layout_copy(lay);
+ pango_layout_set_text(elipse, "...", -1);
+ pango_layout_get_pixel_size(elipse, &ewidth, NULL);
+ g_object_unref(elipse);
+
+ pango_layout_get_pixel_size(lay, &width, NULL);
+ if ((width + offset) > dim.width) {
+ switch (gaim_prefs_get_int(GF_PREF_APPEARANCE_TEXT_CLIPPING)) {
+ case clip_truncate:
+ while (loop) {
+ pango_layout_get_pixel_size(lay, &width, NULL);
+
+ if ((width + offset) <= dim.width)
+ loop = FALSE;
+ else {
+ text = pango_layout_get_text(lay);
+ new_text = g_strndup(text, strlen(text) - 1);
+ pango_layout_set_text(lay, new_text, -1);
+ }
+ }
+ g_free(new_text);
+
+ break;
+ case clip_elipse_start:
+ while (loop) {
+ pango_layout_get_pixel_size(lay, &width, NULL);
+
+ if ((width + offset + ewidth) <= dim.width)
+ loop = FALSE;
+ else {
+ text = pango_layout_get_text(lay);
+ new_text = g_strrndup(text, strlen(text) - 1);
+ pango_layout_set_text(lay, new_text, -1);
+ }
+ }
+ text = pango_layout_get_text(lay);
+ new_text = g_strdup_printf("...%s", text);
+ pango_layout_set_text(lay, new_text, -1);
+ g_free(new_text);
+
+ break;
+ case clip_elipse_middle:
+ while (loop) {
+ pango_layout_get_pixel_size(lay, &width, NULL);
+
+ if ((width + offset + ewidth) <= dim.width)
+ loop = FALSE;
+ else {
+ text = pango_layout_get_text(lay);
+ mid = strlen(text) / 2;
+
+ if (is_even(strlen(text))) {
+ left_text = g_strndup(text, mid);
+ right_text = g_strrndup(text, mid - 1);
+ }
+ else {
+ left_text = g_strndup(text, mid);
+ right_text = g_strrndup(text, mid);
+ }
+ new_text = g_strdup_printf("%s%s", left_text, right_text);
+
+ pango_layout_set_text(lay, new_text, -1);
+ }
+ }
+ new_text = g_strdup_printf("%s...%s", left_text, right_text);
+ g_free(left_text);
+ g_free(right_text);
+
+ pango_layout_set_text(lay, new_text, -1);
+ g_free(new_text);
+
+ break;
+ case clip_elipse_end:
+ while (loop) {
+ pango_layout_get_pixel_size(lay, &width, NULL);
+
+ if ((width + offset + ewidth) <= dim.width)
+ loop = FALSE;
+ else {
+ text = pango_layout_get_text(lay);
+ new_text = g_strndup(text, strlen(text) - 1);
+ pango_layout_set_text(lay, new_text, -1);
+ }
+ }
+ text = pango_layout_get_text(lay);
+ new_text = g_strdup_printf("%s...", text);
+ pango_layout_set_text(lay, new_text, -1);
+ g_free(new_text);
+
+ break;
+ }
+ }
+
+ text = pango_layout_get_text(lay);
+ new_text = g_markup_escape_text(text, -1);
+ pango_layout_set_text(lay, new_text, -1);
+
+ set_color(&lay, use_color, text_color);
+}
+/**********************************************************************/
+gchar *
+g_strrndup(const gchar *src, gint n) {
+ gchar *dest = g_malloc(strlen(src));
+ gint i = 0, j = 0;
+
+ for (i = strlen(src) - n; i < strlen(src); i++) {
+ dest[j] = src[i];
+ j++;
+ }
+ dest[j] = '\0';
+
+ return dest;
+}
+/**********************************************************************/
+void
+set_color(PangoLayout **layout, gboolean custom_color, const gchar *pref) {
+ PangoLayout *lay = (*layout);
+ const gchar *text;
+
+ text = pango_layout_get_text(lay);
+
+ if (custom_color)
+ pango_layout_set_markup(lay, set_text_color(text, pref), -1);
+ else
+ pango_layout_set_markup(lay, g_strdup_printf("<span foreground=\"%s\">%s</span>", "#000000000000", text), -1);
+}
+/**********************************************************************/
+gchar *
+set_text_color(const gchar *text, const gchar *pref) {
+ gchar *ret = NULL;
+
+ ret = g_strdup_printf("<span foreground=\"%s\">%s</span>", gaim_prefs_get_string(pref), text);
+
+ return ret;
+}
+/**********************************************************************/
+gint
+get_proto_icon_size() {
+ switch (gaim_prefs_get_int(GF_PREF_APPEARANCE_PROT_SIZE)) {
+ case isize_tiny: return 16; break;
+ case isize_small: return 24; break;
+ case isize_normal: return 48; break;
+ case isize_large: return 96; break;
+ case isize_huge: return 144; break;
+ }
+ return 0;
+}
+/**********************************************************************/
+void
+get_text_pos(gint *x, gint *y, gboolean line, PangoLayout *layout) {
+ dimensions dim;
+ gint height, width;
+ gint dhh, dhw;
+ gint hh, hw;
+ gint ox, oy;
+ gint ohx, ohy;
+ gint north, east, south, west, lat, lon;
+
+ get_image_size(&dim);
+ pango_layout_get_pixel_size(layout, &width, &height);
+
+ dhh = dim.height / 2;
+ dhw = dim.width / 2;
+ hh = height / 2;
+ hw = width / 2;
+
+ ox = gaim_prefs_get_int(GF_PREF_APPEARANCE_TEXT_X);
+ oy = gaim_prefs_get_int(GF_PREF_APPEARANCE_TEXT_Y);
+
+ ohx = ox / 2;
+ ohy = oy / 2;
+
+ north = line ? oy: height + oy;
+ east = dim.width - (width + ox);
+ south = line ? dim.height - (height * 2 + oy): dim.height - (height + oy);
+ west = ox;
+ lat = line ? dhh - (height + ohy): dhh + ohy; /* y */
+ lon = dhw - (hw + ohx); /* x */
+
+ switch (gaim_prefs_get_int(GF_PREF_APPEARANCE_TEXT_POS)) {
+ case tpos_nw: (*x) = west; (*y) = north; break;
+ case tpos_n: (*x) = lon; (*y) = north; break;
+ case tpos_ne: (*x) = east; (*y) = north; break;
+ case tpos_w: (*x) = west; (*y) = lat; break;
+ case tpos_c: (*x) = lon; (*y) = lat; break;
+ case tpos_e: (*x) = east; (*y) = lat; break;
+ case tpos_sw: (*x) = west; (*y) = south; break;
+ case tpos_s: (*x) = lon; (*y) = south; break;
+ case tpos_se: (*x) = east; (*y) = south; break;
+ }
+}
+/**********************************************************************/
+void
+get_icon_pos(gint *x, gint *y) {
+ dimensions dim;
+ gint height, width;
+ gint dhh, dhw;
+ gint hh, hw;
+ gint ox, oy;
+ gint ohx, ohy;
+ gint north, east, south, west, lat, lon;
+
+ get_image_size(&dim);
+ dhh = dim.height / 2;
+ dhw = dim.width / 2;
+
+ width = height = get_proto_icon_size();
+ hw = hh = width / 2;
+
+ ox = gaim_prefs_get_int(GF_PREF_APPEARANCE_PROT_X);
+ oy = gaim_prefs_get_int(GF_PREF_APPEARANCE_PROT_Y);
+
+ ohx = ox / 2;
+ ohy = oy / 2;
+
+ north = oy;
+ east = dim.width - (width + ox);
+ south = dim.height - (height + oy);
+ west = ox;
+ lat = dhh - (hh + ohy); /* y */
+ lon = dhw - (hw + ohx); /* x */
+
+ switch (gaim_prefs_get_int(GF_PREF_APPEARANCE_PROT_POS)) {
+ case ipos_none: (*x) = -1; (*y) = -1; break;
+ case ipos_nw: (*x) = west; (*y) = north; break;
+ case ipos_n: (*x) = lon; (*y) = north; break;
+ case ipos_ne: (*x) = east; (*y) = north; break;
+ case ipos_w: (*x) = west; (*y) = lat; break;
+ case ipos_c: (*x) = lon; (*y) = lat; break;
+ case ipos_e: (*x) = east; (*y) = lat; break;
+ case ipos_sw: (*x) = west; (*y) = south; break;
+ case ipos_s: (*x) = lon; (*y) = south; break;
+ case ipos_se: (*x) = east; (*y) = south; break;
+ }
+}
+/**********************************************************************/
+GdkPixbuf *
+get_proto_icon(GaimBuddy *buddy) {
+ GaimPluginProtocolInfo *prplinfo = NULL;
+ GdkPixbuf *src = NULL, *ret = NULL;
+ gchar *proto, *file;
+ gint height = 0, width = 0;
+
+ prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol(buddy->account)));
+ proto = g_strdup_printf("%s.png", prplinfo->list_icon(buddy->account, buddy));
+
+ file = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", proto, NULL);
+
+ src = gdk_pixbuf_new_from_file(file, NULL);
+ g_free(file);
+
+ width = height = get_proto_icon_size();
+
+ ret = gdk_pixbuf_scale_simple(src, width, height, GDK_INTERP_BILINEAR);
+ g_object_unref(src);
+
+ return ret;
+}
+/**********************************************************************/
+gboolean
+is_even(gint number) {
+ if ((number & 1) == 1)
+ return FALSE;
+ else
+ return TRUE;
+}
+/**********************************************************************/
--- a/gf_utils.h Sat Dec 27 14:20:24 2003 +0000
+++ b/gf_utils.h Sat Dec 27 14:28:54 2003 +0000
@@ -46,10 +46,10 @@
void set_color(PangoLayout **layout, gboolean custom_color, const gchar *pref);
gchar *set_text_color(const gchar *text, const gchar *pref);
gchar *g_strrndup(const gchar *src, gint n);
-gint get_icon_size();
+gint get_proto_icon_size();
gboolean is_even(gint number);
void get_text_pos(gint *x, gint *y, gboolean line, PangoLayout *layout);
-void get_icon_pos(gint *x, gint *y);
+void get_proto_pos(gint *x, gint *y);
GdkPixbuf *get_proto_icon(GaimBuddy *buddy);
/**********************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/grimdirtreeview.c Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,520 @@
+#include <stdio.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <string.h>
+#include <math.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "grimdirtreeview.h"
+
+#define DIR_COL_ICON 0
+#define DIR_COL_TEXT 1
+#define DIR_COL_PATH 2
+#define DIR_COL_COUNT 3
+
+/* folder icons taken from galeon */
+/* XPM */
+static const char * folder_xpm[] = {
+"16 16 61 1",
+" c None",
+". c #000000",
+"+ c #8D8E8C",
+"@ c #E4E5DF",
+"# c #D5D6CB",
+"$ c #D6D7CA",
+"% c #A3A39D",
+"& c #F5F6F0",
+"* c #ADB198",
+"= c #C2C6A9",
+"- c #C0C3A7",
+"; c #B4B89D",
+"> c #6D705F",
+", c #EAECDB",
+"' c #F6F6F4",
+") c #EAECDA",
+"! c #E8EAD8",
+"~ c #E9EBDB",
+"{ c #E6E8D5",
+"] c #E5E8D4",
+"^ c #E4E7D2",
+"/ c #C7C9B6",
+"( c #F7F7F7",
+"_ c #DADEBF",
+": c #DADEBE",
+"< c #D8DCBC",
+"[ c #D6DBB9",
+"} c #D5D9B7",
+"| c #D3D7B4",
+"1 c #CFD4AF",
+"2 c #CDD2AD",
+"3 c #CBD1AA",
+"4 c #95997C",
+"5 c #F3F3EA",
+"6 c #F3F4EA",
+"7 c #D1D6B2",
+"8 c #CACFA8",
+"9 c #C8CDA5",
+"0 c #929778",
+"a c #F1F3E9",
+"b c #C6CCA3",
+"c c #C4CAA0",
+"d c #8F9474",
+"e c #EFF1E5",
+"f c #CED3AF",
+"g c #CED3AE",
+"h c #CBD0AB",
+"i c #CACFA9",
+"j c #C9CEA7",
+"k c #C6CCA4",
+"l c #C5CAA1",
+"m c #C5CAA2",
+"n c #8D9270",
+"o c #EBECDE",
+"p c #C2C89D",
+"q c #C1C79B",
+"r c #BFC598",
+"s c #C9CCB9",
+"t c #919576",
+"u c #8F9372",
+"v c #666951",
+" ",
+" ",
+" .... ",
+" +@#$%. ",
+" .&*=-;>..... ",
+" .,',,)!~{]^/. ",
+" .(_:<[}|1234. ",
+" .5_:<[}|1234. ",
+" .6<[}|713890. ",
+" .a}|71239bcd. ",
+" .efg2hijklmn. ",
+" .o89bcpqrrrn. ",
+" .s0tdunnnnnv. ",
+" ........... ",
+" ",
+" "};
+/* XPM */
+static const char * folder_open_xpm[] = {
+"16 16 64 1",
+" c None",
+". c #000000",
+"+ c #E4E5DF",
+"@ c #D5D6CB",
+"# c #D6D7CA",
+"$ c #A3A39D",
+"% c #F5F6F0",
+"& c #8D907B",
+"* c #92957E",
+"= c #90937D",
+"- c #979B84",
+"; c #6D705F",
+"> c #EAECDB",
+", c #8A8C7D",
+"' c #8E917B",
+") c #91947F",
+"! c #8B8E7A",
+"~ c #999B87",
+"{ c #919480",
+"] c #989B86",
+"^ c #B1B4A2",
+"/ c #A2A394",
+"( c #F7F7F7",
+"_ c #878A75",
+": c #666858",
+"< c #4B4D3F",
+"[ c #4D4F40",
+"} c #404135",
+"| c #424337",
+"1 c #434437",
+"2 c #404236",
+"3 c #3C3D32",
+"4 c #48493C",
+"5 c #1A1A16",
+"6 c #C6C6BE",
+"7 c #848672",
+"8 c #25261F",
+"9 c #F1F2E9",
+"0 c #DDE0C7",
+"a c #D6DABB",
+"b c #CDD2AC",
+"c c #C7CCA7",
+"d c #989C80",
+"e c #C6C7BE",
+"f c #5F6152",
+"g c #888980",
+"h c #A7AB8C",
+"i c #878A70",
+"j c #9FA19A",
+"k c #EFF0E5",
+"l c #9EA284",
+"m c #80817B",
+"n c #96968D",
+"o c #E3E5D1",
+"p c #83866D",
+"q c #97998D",
+"r c #EDEFE2",
+"s c #A2A688",
+"t c #767671",
+"u c #E7E9DA",
+"v c #D1D3BD",
+"w c #BBBF9D",
+"x c #989B80",
+"y c #6E715C",
+" ",
+" ",
+" .... ",
+" .+@#$. ",
+" .%&*=-;..... ",
+" .>,')!~{]{^/. ",
+" .(_:<[}||12345 ",
+" .67890abbbbbcd.",
+" .efg0bbbbbbbhi.",
+" .j8kabbbbbbbl. ",
+" .mnobbbbbbbbp. ",
+" .qrbbbbbbbbs. ",
+" .tuvwwwwwwxy. ",
+" ........... ",
+" ",
+" "};
+
+
+static void grim_dir_tree_view_class_init(GrimDirTreeViewClass *klass);
+static void grim_dir_tree_view_init(GrimDirTreeView *dir_tree_view);
+static void add_dir(GtkTreeStore *store, GtkTreeIter *parent, gchar *parent_path, gchar *child_path);
+static void expand_cb(GrimDirTreeView *dir_tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data);
+static void collapse_cb(GrimDirTreeView *dir_tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data);
+static void add_root_node(GrimDirTreeView *dir_tree_view);
+
+static gboolean has_subdir(gchar *path);
+
+GType
+grim_dir_tree_view_get_type (void) {
+ static GType dir_tree_view_type = 0;
+
+ if (!dir_tree_view_type) {
+ static const GTypeInfo dir_tree_view_type_info = {
+ sizeof (GrimDirTreeViewClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) grim_dir_tree_view_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GrimDirTreeView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) grim_dir_tree_view_init,
+ };
+
+ dir_tree_view_type = g_type_register_static(GTK_TYPE_TREE_VIEW,
+ "GrimDirTreeView",
+ &dir_tree_view_type_info,
+ 0);
+ }
+
+ return dir_tree_view_type;
+}
+
+static void
+grim_dir_tree_view_class_init(GrimDirTreeViewClass *klass) {
+}
+
+static void
+grim_dir_tree_view_init(GrimDirTreeView *dir_tree_view) {
+ GtkTreeViewColumn *directory;
+ GtkCellRenderer *renderer;
+
+ /* initialize variables */
+ dir_tree_view->store = gtk_tree_store_new(DIR_COL_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
+
+ /* add root node */
+ add_root_node(dir_tree_view);
+
+ /* set globals for tree view */
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(dir_tree_view), FALSE);
+
+ /* create and add the directory column to the tree view */
+ directory = gtk_tree_view_column_new();
+ //gtk_tree_view_column_set_alignment(directory, 0);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(&dir_tree_view->tree_view), directory);
+
+ /* create and pack the cell renderer(s) */
+ renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_column_pack_start(directory, renderer, FALSE);
+ gtk_tree_view_column_add_attribute(directory, renderer, "pixbuf", DIR_COL_ICON);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(directory, renderer, FALSE);
+ gtk_tree_view_column_add_attribute(directory, renderer, "text", DIR_COL_TEXT);
+
+ /* connect signals */
+ g_signal_connect(G_OBJECT(dir_tree_view), "row_expanded", G_CALLBACK(expand_cb), NULL);
+ g_signal_connect(G_OBJECT(dir_tree_view), "row_collapsed", G_CALLBACK(collapse_cb), NULL);
+
+ /* attach the store to the tree view */
+ gtk_tree_view_set_model(GTK_TREE_VIEW(&dir_tree_view->tree_view), GTK_TREE_MODEL(dir_tree_view->store));
+}
+
+static gboolean
+has_subdir(gchar *path) {
+ GDir *directory;
+ gchar *new_path, *name;
+
+ if (g_path_is_absolute(path)) {
+ if ((directory = g_dir_open(path, 0, FALSE)) != NULL) {
+ while ((name = g_strdup(g_dir_read_name(directory))) != NULL) {
+ /* add check for show hidden when I add the property */
+ if (name[0] == '.') {
+ g_free(name);
+ continue;
+ }
+
+ if (path != NULL)
+ new_path = g_strconcat(path, name, NULL);
+ else
+ new_path = g_strdup(name);
+
+ if (g_file_test(new_path, G_FILE_TEST_IS_DIR)) {
+ g_free(new_path);
+ g_dir_close(directory);
+ return TRUE;
+ }
+ g_free(name);
+ g_free(new_path);
+ }
+ g_dir_close(directory);
+ }
+ }
+ return FALSE;
+}
+
+static void
+add_dir(GtkTreeStore *store, GtkTreeIter *parent, gchar *parent_path, gchar *child_path) {
+ GdkPixbuf *pixbuf;
+ GtkTreeIter current, child;
+ gchar *new_path;
+
+ /* tweak when show hidden property is added */
+ if (child_path[0] == '.')
+ return;
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data(folder_xpm);
+
+ if (parent_path != NULL)
+ new_path = g_strconcat(parent_path, child_path, G_DIR_SEPARATOR_S, NULL);
+ else
+ if (g_ascii_strcasecmp(child_path, G_DIR_SEPARATOR_S) == 0)
+ new_path = g_strdup(child_path);
+ else
+ new_path = g_strconcat(child_path, G_DIR_SEPARATOR_S, NULL);
+
+ if (g_file_test(new_path, G_FILE_TEST_IS_DIR)) {
+ gtk_tree_store_append(store, &current, parent);
+ gtk_tree_store_set(store, &current, DIR_COL_ICON, pixbuf, DIR_COL_TEXT, child_path, DIR_COL_PATH, new_path, -1);
+
+ if (has_subdir(new_path)) {
+ gtk_tree_store_append(store, &child, &current);
+ gtk_tree_store_set(store, &child, DIR_COL_TEXT, "", DIR_COL_PATH, NULL, -1);
+ }
+ }
+
+ g_object_unref(pixbuf);
+ g_free(new_path);
+}
+
+static void
+expand_cb(GrimDirTreeView *dir_tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data) {
+ GdkPixbuf *pixbuf;
+ GdkCursor *cursor;
+ GtkTreeIter child;
+ GtkTreeSortable *sortable;
+ GDir *directory;
+ gchar *dir_path, *child_path = NULL;
+ gchar *name;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), iter, DIR_COL_PATH, &dir_path, -1);
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data(folder_open_xpm);
+ gtk_tree_store_set(dir_tree_view->store, iter, DIR_COL_ICON, pixbuf, -1);
+ g_object_unref(pixbuf);
+
+ if (gtk_tree_model_iter_children(GTK_TREE_MODEL(dir_tree_view->store), &child, iter)) {
+ gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), &child, DIR_COL_PATH, &child_path);
+
+ if (child_path == NULL) {
+ if ((directory = g_dir_open(dir_path, 0, NULL)) != NULL) {
+ cursor = gdk_cursor_new(GDK_WATCH);
+ if (!GTK_WIDGET_REALIZED(dir_tree_view))
+ gtk_widget_realize(GTK_WIDGET(dir_tree_view));
+ gdk_window_set_cursor(GTK_WIDGET(dir_tree_view)->window, cursor);
+ gtk_main_iteration();
+ while ((name = g_strdup(g_dir_read_name(directory))) != NULL) {
+ add_dir(dir_tree_view->store, iter, dir_path, name);
+ g_free(name);
+ }
+ g_dir_close(directory);
+ gdk_window_set_cursor(GTK_WIDGET(dir_tree_view)->window, NULL);
+ gdk_cursor_unref(cursor);
+ }
+ gtk_tree_store_remove(dir_tree_view->store, &child);
+ sortable = GTK_TREE_SORTABLE(dir_tree_view->store);
+ gtk_tree_sortable_set_sort_column_id(sortable, DIR_COL_TEXT, GTK_SORT_ASCENDING);
+ }
+ }
+}
+
+static void
+collapse_cb(GrimDirTreeView *dir_tree_view, GtkTreeIter *iter, GtkTreePath *path, gpointer data) {
+ GdkPixbuf *pixbuf;
+ GtkTreeIter holder, child;
+ gint count, i;
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data(folder_xpm);
+ gtk_tree_store_set(dir_tree_view->store, iter, DIR_COL_ICON, pixbuf, -1);
+ g_object_unref(pixbuf);
+
+ count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(dir_tree_view->store), iter);
+
+ gtk_tree_store_append(dir_tree_view->store, &holder, iter);
+ gtk_tree_store_set(dir_tree_view->store, &holder, DIR_COL_PATH, NULL, -1);
+
+ for (i = 0; i < count; i++) {
+ gtk_tree_model_iter_children(GTK_TREE_MODEL(dir_tree_view->store), &child, iter);
+ gtk_tree_store_remove(dir_tree_view->store, &child);
+ }
+}
+
+GtkWidget *
+grim_dir_tree_view_new() {
+ return GTK_WIDGET (g_object_new(grim_dir_tree_view_get_type(), NULL));
+}
+
+const gchar *
+grim_dir_tree_view_get_path(GrimDirTreeView *dir_tree_view) {
+ GtkTreeSelection *selection;
+ GtkTreeIter selected;
+ gchar *path = NULL, *ret_path;
+
+ selection = gtk_tree_view_get_selection(&dir_tree_view->tree_view);
+ if (gtk_tree_selection_get_selected(selection, NULL, &selected)) {
+ gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), &selected, DIR_COL_PATH, &path, -1);
+
+ if (path[0] == path[1] && path[0] == G_DIR_SEPARATOR)
+ path++;
+ }
+
+ ret_path = g_strdup(path);
+
+ return ret_path;
+}
+
+gboolean
+grim_dir_tree_view_set_path(GrimDirTreeView *dir_tree_view, const gchar *path) {
+ GtkTreeSelection *selection;
+ GtkTreePath *tree_path;
+ GtkTreeIter parent, child;
+ gchar **directories;
+ gchar *search_path = NULL, *new_path = NULL, *child_path = NULL;
+ gint dir = 0;
+
+ directories = g_strsplit(path, G_DIR_SEPARATOR_S, 0);
+
+ while (directories[dir] != NULL) {
+ if (dir == 0) {
+ search_path = g_strdup(G_DIR_SEPARATOR_S);
+
+ gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dir_tree_view->store), &parent);
+
+ tree_path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_tree_view->store), &parent);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(dir_tree_view), tree_path, TRUE);
+ gtk_tree_path_free(tree_path);
+
+ dir++;
+ }
+
+ new_path = g_strdup_printf("%s%s%s", search_path, directories[dir], G_DIR_SEPARATOR_S);
+
+ if(gtk_tree_model_iter_children(GTK_TREE_MODEL(dir_tree_view->store), &child, &parent)) {
+ g_free(search_path);
+ search_path = g_strdup(new_path);
+ g_free(new_path);
+
+ while (1) {
+ gtk_tree_model_get(GTK_TREE_MODEL(dir_tree_view->store), &child, DIR_COL_PATH, &child_path, -1);
+
+ if (g_ascii_strcasecmp(search_path, child_path) == 0) {
+ if (g_ascii_strncasecmp(path, child_path, strlen(path)) != 0) {
+ tree_path = gtk_tree_model_get_path(GTK_TREE_MODEL(dir_tree_view->store), &child);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(dir_tree_view), tree_path, TRUE);
+ gtk_tree_path_free(tree_path);
+
+ parent = child;
+ }
+
+ break;
+ }
+
+ if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(dir_tree_view->store), &child)) {
+ g_free(search_path);
+ g_strfreev(directories);
+ return FALSE;
+ break;
+ }
+ }
+ }
+
+ dir++;
+ }
+
+ if (search_path != NULL)
+ g_free(search_path);
+
+ g_strfreev(directories);
+
+ gtk_widget_grab_focus(GTK_WIDGET(dir_tree_view));
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dir_tree_view));
+ gtk_tree_selection_unselect_all(selection);
+ gtk_tree_selection_select_iter(selection, &child);
+
+ return FALSE;
+}
+
+void
+grim_dir_tree_view_set_show_hidden(GrimDirTreeView *dir_tree_view, gboolean value) {
+ const gchar *path;
+
+ dir_tree_view->show_hidden = value;
+ path = grim_dir_tree_view_get_path(dir_tree_view);
+
+ gtk_tree_store_clear(dir_tree_view->store);
+
+ add_root_node(dir_tree_view);
+
+}
+
+gboolean
+grim_dir_tree_view_get_show_hidden(GrimDirTreeView *dir_tree_view) {
+ return dir_tree_view->show_hidden;
+}
+
+static void
+add_root_node(GrimDirTreeView *dir_tree_view) {
+ #ifdef _WIN32
+ gchar *drive;
+ gint i = 0;
+ guint drives = 0;
+
+ drives = GetLogicalDrives();
+ for (i = 0; i < 32; i++) {
+ if ((drives & (int)exp2(i)) == exp2(i)) {
+ drive = g_strdup_printf("%c:\\", 65 + i);
+ add_dir(dir_tree_view->store, NULL, NULL, drive);
+ g_free(drive);
+ }
+ }
+ #else
+ add_dir(dir_tree_view->store, NULL, NULL, G_DIR_SEPARATOR_S);
+ #endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/grimdirtreeview.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,48 @@
+#ifndef __GRIM_DIR_TREE_VIEW__
+#define __GRIM_DIR_TREE_VIEW__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtktreeview.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GRIM_TYPE_DIR_TREE_VIEW (grim_dir_tree_view_get_type ())
+#define GRIM_DIR_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRIM_TYPE_DIR_TREE_VIEW, GrimDirTreeView))
+#define GRIM_DIR_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRIM_TYPE_DIR_TREE_VIEW, GrimDirTreeViewClass))
+#define GRIM_IS_DIR_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRIM_TYPE_DIR_TREE_VIEW))
+#define GRIM_IS_DIR_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRIM_TYPE_DIR_TREE_VIEW))
+#define GRIM_DIR_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRIM_TYPE_DIR_TREE_VIEW, GrimDirTreeViewClass))
+
+typedef struct _GrimDirTreeView GrimDirTreeView;
+typedef struct _GrimDirTreeViewClass GrimDirTreeViewClass;
+
+struct _GrimDirTreeView {
+ GtkTreeView tree_view;
+
+ GtkTreeStore *store;
+
+ gboolean show_hidden;
+};
+
+struct _GrimDirTreeViewClass {
+ GtkTreeViewClass parent_class;
+};
+
+/* creators */
+GType grim_dir_tree_view_get_type(void);
+GtkWidget *grim_dir_tree_view_new(void);
+
+/* Accessors */
+const gchar *grim_dir_tree_view_get_path(GrimDirTreeView *dir_tree_view);
+gboolean grim_dir_tree_view_set_path(GrimDirTreeView *dir_tree_view, const gchar *path);
+void grim_dir_tree_view_set_show_hidden(GrimDirTreeView *dir_tree_view, gboolean value);
+gboolean grim_dir_tree_view_get_show_hidden(GrimDirTreeView *dir_tree_view);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GTK_DIR_TREE_VIEW__ */
--- a/guifications.c Sat Dec 27 14:20:24 2003 +0000
+++ b/guifications.c Sat Dec 27 14:28:54 2003 +0000
@@ -324,7 +324,7 @@
g_object_unref(background);
if (gaim_prefs_get_int(GF_PREF_APPEARANCE_PROT_POS) != ipos_none) {
- get_icon_pos(&px, &py);
+ get_proto_pos(&px, &py);
protocol = get_proto_icon(buddy);
gdk_draw_pixbuf(GDK_DRAWABLE(memmap), gf_window->style->bg_gc[GTK_STATE_NORMAL], protocol, 0, 0, px, py, -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0);
g_object_unref(protocol);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/guifications.h Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,138 @@
+/*
+ Guifications - The notification plugin to end all notification plugins!
+ Copyright (C) 2003 Gary Kramlich
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#ifndef GUIFICATIONS_H
+#define GUIFICATIONS_H
+
+#include <glib.h>
+#include <gdk/gdk.h>
+
+#include "gaim.h"
+#include "plugin.h"
+#include "blist.h"
+
+#define my_id "Gtk-amc_grim-Guifications"
+#define my_name "Guifications"
+#define my_version "1.5-Internal"
+#define my_summary "The notification plugin to end all notification plugins!"
+#define my_description "Guifications: The Pimpin' Penguin Notification Plugin thats good for the soul!"
+#define my_authors "Gary Kramlich <amc_grim@users.sf.net>"
+#define my_homepage "http://guifications.sourceforge.net"
+/***********************************************************************
+ Enums
+***********************************************************************/
+typedef enum _gf_guification_event {
+ event_signon = 0,
+ event_signoff,
+ event_away,
+ event_back,
+ event_idle,
+ event_unidle
+} gf_guification_event;
+/**********************************************************************/
+typedef enum _gf_gfpos {
+ gfpos_nw = 0,
+ gfpos_ne,
+ gfpos_sw,
+ gfpos_se
+} gf_gfpos;
+/**********************************************************************/
+typedef enum _gf_tpos {
+ tpos_nw = 0,
+ tpos_n,
+ tpos_ne,
+ tpos_w,
+ tpos_c,
+ tpos_e,
+ tpos_sw,
+ tpos_s,
+ tpos_se
+} gf_tpos;
+/**********************************************************************/
+typedef enum _gf_ipos {
+ ipos_none = 0,
+ ipos_nw,
+ ipos_n,
+ ipos_ne,
+ ipos_w,
+ ipos_c,
+ ipos_e,
+ ipos_sw,
+ ipos_s,
+ ipos_se
+} gf_ipos;
+/**********************************************************************/
+typedef enum _gf_position {
+ pos_nw = 0,
+ pos_n,
+ pos_ne,
+ pos_w,
+ pos_c,
+ pos_e,
+ pos_sw,
+ pos_s,
+ pos_se
+} gf_position;
+/**********************************************************************/
+typedef enum _gf_icon_size {
+ isize_tiny = 0,
+ isize_small,
+ isize_normal,
+ isize_large,
+ isize_huge
+} gf_icon_size;
+/**********************************************************************/
+typedef enum _gf_clip {
+ clip_truncate = 0,
+ clip_elipse_start,
+ clip_elipse_middle,
+ clip_elipse_end
+} gf_clip;
+/**********************************************************************/
+typedef enum _gf_mouse {
+ mouse_destroy = 0,
+ mouse_info,
+ mouse_conversation,
+ mouse_log,
+ mouse_context,
+ mouse_count
+} gf_mouse;
+/**********************************************************************/
+typedef enum _gf_zoom {
+ zoom_200 = 0,
+ zoom_175,
+ zoom_150,
+ zoom_125,
+ zoom_100,
+ zoom_75,
+ zoom_50,
+ zoom_25
+} gf_zoom;
+/**********************************************************************/
+typedef enum _gf_icon {
+ icon_protocol = 0,
+ icon_buddy,
+ icon_status
+} gf_icon;
+/***********************************************************************
+ Prototypes
+***********************************************************************/
+void gf_destroy_all();
+GdkPixmap *make_guification(GaimBuddy *buddy, gf_guification_event event);
+/**********************************************************************/
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/Makefile.am Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,35 @@
+EXTRA_DIST = \
+ clip_elipse_end.png \
+ clip_elipse_middle.png \
+ clip_elipse_start.png \
+ clip_truncate.png \
+ position_center.png \
+ position_east.png \
+ position_none.png \
+ position_north.png \
+ position_north_east.png \
+ position_north_west.png \
+ position_south.png \
+ position_south_east.png \
+ position_south_west.png \
+ position_west.png \
+ protocol_size_huge.png \
+ protocol_size_large.png \
+ protocol_size_normal.png \
+ protocol_size_small.png \
+ protocol_size_tiny.png \
+ window_position_north_east.png \
+ window_position_north_west.png \
+ window_position_south_east.png \
+ window_position_south_west.png \
+ zoom_in.png \
+ zoom_normal.png \
+ zoom_out.png
+
+EXTRA_DIST2 = Makefile.mingw
+
+guificationsconfpixdir = $(datadir)/pixmaps/gaim/guifications/conf
+guificationsconfpix_DATA = $(EXTRA_DIST)
+
+guificationsbackgroundspixdir = $(datadir)/pixmaps/gaim/guifications/backgrounds
+guificationsbackgroundspix_DATA = background_default.png
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/Makefile.mingw Sat Dec 27 14:28:54 2003 +0000
@@ -0,0 +1,17 @@
+#
+# Makefile.mingw
+#
+# Description: Makefile for guifications pixmaps
+#
+datadir = ../../../win32-install-dir
+include ./Makefile.am
+
+install:
+ if test '$(guificationsconfpix_DATA)'; then \
+ mkdir -p $(guificationsconfpixdir); \
+ cp $(guificationsconfpix_DATA) $(guificationsconfpixdir); \
+ fi;
+ if test '$(guificationsbackgroundspix_DATA)'; then \
+ mkdir -p $(guificationsbackgroundspixdir); \
+ cp $(guificationsbackgroundspix_DATA) $(guificationsbackgroundspixdir); \
+ fi;
Binary file pixmaps/background_default.png has changed
Binary file pixmaps/clip_elipse_end.png has changed
Binary file pixmaps/clip_elipse_middle.png has changed
Binary file pixmaps/clip_elipse_start.png has changed
Binary file pixmaps/clip_truncate.png has changed
Binary file pixmaps/position_center.png has changed
Binary file pixmaps/position_east.png has changed
Binary file pixmaps/position_none.png has changed
Binary file pixmaps/position_north.png has changed
Binary file pixmaps/position_north_east.png has changed
Binary file pixmaps/position_north_west.png has changed
Binary file pixmaps/position_south.png has changed
Binary file pixmaps/position_south_east.png has changed
Binary file pixmaps/position_south_west.png has changed
Binary file pixmaps/position_west.png has changed
Binary file pixmaps/protocol_size_huge.png has changed
Binary file pixmaps/protocol_size_large.png has changed
Binary file pixmaps/protocol_size_normal.png has changed
Binary file pixmaps/protocol_size_small.png has changed
Binary file pixmaps/protocol_size_tiny.png has changed
Binary file pixmaps/window_position_north_east.png has changed
Binary file pixmaps/window_position_north_west.png has changed
Binary file pixmaps/window_position_south_east.png has changed
Binary file pixmaps/window_position_south_west.png has changed
Binary file pixmaps/zoom_in.png has changed
Binary file pixmaps/zoom_normal.png has changed
Binary file pixmaps/zoom_out.png has changed