+2007-10-11 [wwp] 3.0.2cvs59
+
+ * src/pixmaps/anonymous.xpm
+ * src/editaddress.c
+ * src/Makefile.am
+ * src/stock_pixmap.c
+ * src/stock_pixmap.h
+ Fix a leak, gettext-ize the photo label.
+ Don't clear the existing picture if loading
+ a new one fails. Use a default 'anonymous'
+ picture (this new xpm has been added to the
+ internal stock_pixmap API). Add a
+ "Set picture" context menu entry.
+
2007-10-11 [colin] 3.0.2cvs58
* src/messageview.c
( cvs diff -u -r 1.382.2.415 -r 1.382.2.416 src/compose.c; ) > 3.0.2cvs56.patchset
( cvs diff -u -r 1.12.2.49 -r 1.12.2.50 src/prefs_template.c; ) > 3.0.2cvs57.patchset
( cvs diff -u -r 1.94.2.158 -r 1.94.2.159 src/messageview.c; cvs diff -u -r 1.60.2.52 -r 1.60.2.53 src/prefs_actions.c; cvs diff -u -r 1.12.2.50 -r 1.12.2.51 src/prefs_template.c; cvs diff -u -r 1.13.2.32 -r 1.13.2.33 src/common/plugin.c; cvs diff -u -r 1.2.4.21 -r 1.2.4.22 src/common/template.c; ) > 3.0.2cvs58.patchset
+( diff -u /dev/null src/pixmaps/anonymous.xpm; cvs diff -u -r 1.14.2.37 -r 1.14.2.38 src/editaddress.c; cvs diff -u -r 1.155.2.78 -r 1.155.2.79 src/Makefile.am; cvs diff -u -r 1.25.2.48 -r 1.25.2.49 src/stock_pixmap.c; cvs diff -u -r 1.18.2.31 -r 1.18.2.32 src/stock_pixmap.h; ) > 3.0.2cvs59.patchset
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=58
+EXTRA_VERSION=59
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
pixmaps/address_book.xpm \
pixmaps/address_search.xpm \
pixmaps/address.xpm \
+ pixmaps/anonymous.xpm \
pixmaps/book.xpm \
pixmaps/category.xpm \
pixmaps/checkbox_off.xpm \
gtk_widget_hide( personeditdlg.container );
}
-static void addressbook_edit_person_unset_picture (void *obj, guint action, void *data)
+void addressbook_edit_person_set_picture(void)
{
- GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
- gdk_pixbuf_fill(pixbuf, 0xffffff00);
+ GError *error = NULL;
+ gchar *filename;
+ int width, height, scalewidth, scaleheight;
+
+ if ( (filename = filesel_select_file_open(_("Choose a picture"), NULL)) ) {
+ GdkPixbuf *pixbuf = NULL;
+ gdk_pixbuf_get_file_info(filename, &width, &height);
+
+ if ( width > 128 || height > 128 ) {
+ if (width > height) {
+ scaleheight = (height * 128) / width;
+ scalewidth = 128;
+ }
+ else {
+ scalewidth = (width * 128) / height;
+ scaleheight = 128;
+ }
+ pixbuf = gdk_pixbuf_new_from_file_at_scale(filename,
+ scalewidth, scaleheight, TRUE, &error);
+ } else {
+ pixbuf = gdk_pixbuf_new_from_file(filename, &error);
+ }
+ if (error) {
+ alertpanel_error(_("Failed to import image: \n%s"),
+ error->message);
+ g_error_free(error);
+ error = NULL;
+ /* keep the previous picture if any */
+ g_free(filename);
+ if (pixbuf)
+ g_object_unref(pixbuf);
+ return;
+ }
+ personeditdlg.picture_set = TRUE;
+ g_free(filename);
+ gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
+ g_object_unref(pixbuf);
+ }
+}
+
+static void addressbook_edit_person_clear_picture(void)
+{
+ GdkPixbuf *pixbuf;
+
+ stock_pixbuf_gdk(NULL, STOCK_PIXMAP_ANONYMOUS, &pixbuf);
personeditdlg.picture_set = FALSE;
gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
g_object_unref(pixbuf);
}
+static void addressbook_edit_person_set_picture_menu_cb (void *obj, guint action, void *data)
+{
+ addressbook_edit_person_set_picture();
+}
+
+static void addressbook_edit_person_unset_picture_menu_cb (void *obj, guint action, void *data)
+{
+ addressbook_edit_person_clear_picture();
+}
+
static GtkItemFactoryEntry editaddr_popup_entries[] =
{
- {N_("/_Unset picture"), NULL, addressbook_edit_person_unset_picture, 0, NULL},
+ {N_("/_Set picture"), NULL, addressbook_edit_person_set_picture_menu_cb, 0, NULL},
+ {N_("/_Unset picture"), NULL, addressbook_edit_person_unset_picture_menu_cb, 0, NULL},
};
-static void addressbook_edit_person_set_picture(GtkWidget *widget,
+static void addressbook_edit_person_set_picture_cb(GtkWidget *widget,
GdkEventButton *event, gpointer data)
-{
- GError *error = NULL;
- gchar *filename;
- int width, height, scalewidth, scaleheight;
-
+{
if (event->button == 1) {
- if ( (filename = filesel_select_file_open(_("Choose a picture"), NULL)) ) {
- GdkPixbuf *pixbuf = NULL;
- gdk_pixbuf_get_file_info(filename, &width, &height);
-
- if ( width > 128 || height > 128 ) {
- if (width > height) {
- scaleheight = (height * 128) / width;
- scalewidth = 128;
- }
- else {
- scalewidth = (width * 128) / height;
- scaleheight = 128;
- }
- pixbuf = gdk_pixbuf_new_from_file_at_scale(filename,
- scalewidth, scaleheight, TRUE, &error);
- } else {
- pixbuf = gdk_pixbuf_new_from_file(filename, &error);
- }
- if (error) {
- alertpanel_error(_("Failed to import image: \n%s"),
- error->message);
- g_error_free(error);
- error = NULL;
- }
- personeditdlg.picture_set = TRUE;
- g_free(filename);
- gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
- g_object_unref(pixbuf);
- }
+ addressbook_edit_person_set_picture();
} else {
gtk_menu_popup(GTK_MENU(personeditdlg.editaddr_popupmenu),
NULL, NULL, NULL, NULL,
const gchar *locale;
gint top = 0;
gint n_entries;
- GdkPixbuf *pixbuf;
vbox = gtk_vbox_new( FALSE, 20 );
hbox = gtk_hbox_new( FALSE, 8 );
/* User's picture */
ebox_picture = gtk_event_box_new();
- frame_picture = gtk_frame_new("Photo");
+ frame_picture = gtk_frame_new(_("Photo"));
/* Room for a photo */
- pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
- gdk_pixbuf_fill(pixbuf, 0xffffff00);
- personeditdlg.picture_set = FALSE;
- personeditdlg.image = gtk_image_new_from_pixbuf(pixbuf);
- g_object_unref(pixbuf);
+ personeditdlg.image = gtk_image_new();
+ addressbook_edit_person_clear_picture();
gtk_container_add(GTK_CONTAINER(ebox_picture), personeditdlg.image);
gtk_container_add(GTK_CONTAINER(frame_picture), ebox_picture);
gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label );
g_signal_connect(G_OBJECT(ebox_picture), "button_press_event",
- G_CALLBACK(addressbook_edit_person_set_picture), NULL);
+ G_CALLBACK(addressbook_edit_person_set_picture_cb), NULL);
n_entries = sizeof(editaddr_popup_entries) /
sizeof(editaddr_popup_entries[0]);
gboolean get_focus) {
static gboolean cancelled;
GError *error = NULL;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
/* set transient data */
current_abf = abf;
current_person = person;
personeditdlg.editNew = FALSE;
if( current_person ) {
+ gchar *filename;
+
if( ADDRITEM_NAME(current_person) )
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), ADDRITEM_NAME(person) );
if( current_person->picture ) {
- gchar *filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
+ filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
current_person->picture, ".png", NULL );
if (is_file_exist(filename)) {
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
} else {
goto no_img;
}
- g_free(filename);
+ gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
} else {
no_img:
- personeditdlg.picture_set = FALSE;
- pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 48, 48);
- gdk_pixbuf_fill(pixbuf, 0xffffff00);
+ addressbook_edit_person_clear_picture();
+ }
+ g_free(filename);
+ if (pixbuf) {
+ g_object_unref(pixbuf);
+ pixbuf = NULL;
}
- gtk_image_set_from_pixbuf(GTK_IMAGE(personeditdlg.image), pixbuf);
- g_object_unref(pixbuf);
- pixbuf = NULL;
if( current_person->firstName )
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), current_person->firstName );
--- /dev/null
+/* XPM */
+static char * anonymous_xpm[] = {
+"96 96 10 1",
+" c None",
+". c #565656",
+"+ c #333333",
+"@ c #272727",
+"# c #1B1B1B",
+"$ c #666666",
+"% c #383838",
+"& c #434343",
+"* c #747474",
+"= c #898989",
+" ",
+" ",
+" ",
+" ",
+" ",
+" .+@ .#. ",
+" @+++++++++++++@$ ",
+" @++++++++++++++++++++@ ",
+" %+++++++++++++++++++++++@$ ",
+" .@++#+++++++++++++++++++++++@ ",
+" &+++++++++++++++++++++++++++++@& ",
+" %+++++++++++++++++++++++++++++++#* ",
+" +++++++++++++++++++++++++++++++++#$ ",
+" %++++++++++++++++++++++++++++++++++#% ",
+" +++++++++++++++++++++++++++++++++++++. ",
+" @+++++++++++++++++++++++++++++++++++++# ",
+" .+++++++++++++++++++++++++++++++++++++++# ",
+" @++++++++++++++++++++++++++++++++++++++++@ ",
+" ++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++ ",
+" %++++++++++++++++++++++++++++++++++++++++++@ ",
+" @+++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" #+++++++++++++++++++++++++++++++++++++++++++ ",
+" +++++++++++++++++++++++++++++++++++++++++++% ",
+" .+++++++++++++++++++++++++++++++++++++++++++$ ",
+" @+++++++++++++++++++++++++++++++++++++++++++ ",
+" +++++++++++++++++++++++++++++++++++++++++++# ",
+" #++++++++++++++++++++++++++++++++++++++++++# ",
+" ++++++++++++++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++++++++++++++* ",
+" #+++++++++++++++++++++++++++++++++++++++++++. ",
+" @+++++++++++++++++++++++++++++++++++++++++++* ",
+" &+++++++++++++++++++++++++++++++++++++++++++ ",
+" +++++++++++++++++++++++++++++++++++++++++++ ",
+" @+++++++++++++++++++++++++++++++++++++++++@ ",
+" @++++++++++++++++++++++++++++++++++++++++ ",
+" +++++++++++++++++++++++++++++++++++++++# ",
+" @++++++++++++++++++++++++++++++++++++++ ",
+" +++++++++++++++++++++++++++++++++++++# ",
+" +++++++++++++++++++++++++++++++++++@& ",
+" ++++++++++++++++++++++++++++++++++@ ",
+" $+++++++++++++++++++++++++++++++++@ ",
+" $++++++++++++++++++++++++++++++++% ",
+" ++++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++++ ",
+" @++++++++++++++++++++++++++++++@ ",
+" ++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++ ",
+" ++++++++++++++++++++++++++++++ ",
+" @+++++++++++++++++++++++++++++ ",
+" #+++++++++++++++++++++++++++++ ",
+" &++++++++++++++++++++++++++++++. ",
+" &++++++++++++++++++++++++++++++++& ",
+" %++++++++++++++++++++++++++++++++++% ",
+" #++++++++++++++++++++++++++++++++++# ",
+" ++++++++++++++++++++++++++++++++++++ ",
+" @++++++++++++++++++++++++++++++++++++@ ",
+" %++++++++++++++++++++++++++++++++++++++& ",
+" &++++++++++++++++++++++++++++++++++++++++++& ",
+" ##++++++++++++++++++++++++++++++++++++++++++++## ",
+" %++++++++++++++++++++++++++++++++++++++++++++++++++% ",
+" &++++++++++++++++++++++++++++++++++++++++++++++++++++++& ",
+" %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% ",
+" .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. ",
+" .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. ",
+" @++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% ",
+" .#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#. ",
+" %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++& ",
+" $#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#$ ",
+" =#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ",
+"&#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#%",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
+"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"};
#include "pixmaps/addr_one.xpm"
#include "pixmaps/addr_two.xpm"
#include "pixmaps/address.xpm"
+#include "pixmaps/anonymous.xpm"
#include "pixmaps/book.xpm"
#include "pixmaps/category.xpm"
#include "pixmaps/checkbox_off.xpm"
{address_xpm , NULL, NULL, "address", NULL},
{address_book_xpm , NULL, NULL, "address_book", NULL},
{address_search_xpm , NULL, NULL, "address_search", NULL},
+ {anonymous_xpm , NULL, NULL, "anonymous", NULL},
{book_xpm , NULL, NULL, "book", NULL},
{category_xpm , NULL, NULL, "category", NULL},
{checkbox_off_xpm , NULL, NULL, "checkbox_off", NULL},
STOCK_PIXMAP_ADDRESS,
STOCK_PIXMAP_ADDRESS_BOOK,
STOCK_PIXMAP_ADDRESS_SEARCH,
+ STOCK_PIXMAP_ANONYMOUS,
STOCK_PIXMAP_BOOK,
STOCK_PIXMAP_CATEGORY,
STOCK_PIXMAP_CHECKBOX_OFF,