changeset 15415:6e1e72d085c5

merge of '40a73bb689b4b47c5070a2416c353ea7ee080ce2' and 'baf51c5a03d7cf19df754fa0793aeca16ead44d1'
author Ethan Blanton <elb@pidgin.im>
date Thu, 25 Jan 2007 19:00:52 +0000
parents f733d8042f96 (current diff) e6b40365930c (diff)
children 0482dae153d4
files
diffstat 8 files changed, 139 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/silc/Makefile.am	Thu Jan 25 19:00:02 2007 +0000
+++ b/libpurple/protocols/silc/Makefile.am	Thu Jan 25 19:00:52 2007 +0000
@@ -30,6 +30,6 @@
 endif
 
 AM_CPPFLAGS = \
-	-I$(top_srcdir)/libgaim \
+	-I$(top_srcdir)/libpurple \
 	$(GLIB_CFLAGS) \
 	$(DEBUG_CFLAGS)
--- a/pidgin/gtkblist.c	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkblist.c	Thu Jan 25 19:00:52 2007 +0000
@@ -2217,42 +2217,6 @@
         return td;
 }
 
-static gboolean pixbuf_is_opaque(GdkPixbuf *pixbuf) {
-        int width, height, rowstride, i;
-        unsigned char *pixels;
-        unsigned char *row;
-
-        if (!gdk_pixbuf_get_has_alpha(pixbuf))
-                return TRUE;
-
-        width = gdk_pixbuf_get_width (pixbuf);
-        height = gdk_pixbuf_get_height (pixbuf);
-        rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-        pixels = gdk_pixbuf_get_pixels (pixbuf);
-
-        row = pixels;
-        for (i = 3; i < rowstride; i+=4) {
-                if (row[i] != 0xff)
-                        return FALSE;
-        }
-
-        for (i = 1; i < height - 1; i++) {
-                row = pixels + (i*rowstride);
-                if (row[3] != 0xff || row[rowstride-1] != 0xff) {
-                        printf("0: %d, last: %d\n", row[3], row[rowstride-1]);
-                        return FALSE;
-                }
-        }
-
-        row = pixels + ((height-1) * rowstride);
-        for (i = 3; i < rowstride; i+=4) {
-                if (row[i] != 0xff)
-                        return FALSE;
-        }
-
-        return TRUE;
-}
-
 static void gaim_gtk_blist_paint_tip(GtkWidget *widget, GdkEventExpose *event, GaimBlistNode *node)
 {
         GtkStyle *style;
@@ -2277,7 +2241,7 @@
         for(l = gtkblist->tooltipdata; l; l = l->next)
         {
                 struct tooltip_data *td = l->data;
-                if (td->avatar && pixbuf_is_opaque(td->avatar))
+                if (td->avatar && gaim_gdk_pixbuf_is_opaque(td->avatar))
                         gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
                                            NULL, gtkblist->tipwindow, "tooltip", max_width - (td->avatar_width+12)-1, current_height-1,td->avatar_width+2, td->avatar_height+2);
 
--- a/pidgin/gtkdialogs.c	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkdialogs.c	Thu Jan 25 19:00:52 2007 +0000
@@ -349,7 +349,7 @@
 		  "It is written using GTK+.<BR><BR>"
 		  "You may modify and redistribute the program under "
 		  "the terms of the GPL (version 2 or later).  A copy of the GPL is "
-		  "contained in the 'COPYING' file distributed with Gaim.  "
+		  "contained in the 'COPYING' file distributed with " PIDGIN_NAME ".  "
 		  PIDGIN_NAME " is copyrighted by its contributors.  See the 'COPYRIGHT' "
 		  "file for the complete list of contributors.  We provide no "
 		  "warranty for this program.<BR><BR>"));
--- a/pidgin/gtkstatusbox.c	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Thu Jan 25 19:00:52 2007 +0000
@@ -593,7 +593,33 @@
 	else if (status_box->connecting)
 		pixbuf = status_box->connecting_pixbufs[status_box->connecting_index];
 	else
-	{
+	  {
+	    GaimStatusType *status_type;
+	    GaimStatusPrimitive prim;
+	    GtkIconSize icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL);
+	    if (account_status) {
+	    	status_type = gaim_status_get_type(gaim_account_get_active_status(acct));
+	        prim = gaim_status_type_get_primitive(status_type);
+	    } else {
+	    	prim = gaim_savedstatus_get_type(saved_status);
+	    }
+
+	    if (prim == GAIM_STATUS_UNAVAILABLE)
+	      	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_BUSY,
+		   			         icon_size, "GtkTreeView");
+	    else if (prim == GAIM_STATUS_AWAY)
+	      	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY,
+		 			         icon_size, "GtkTreeView");
+	    else if (prim == GAIM_STATUS_EXTENDED_AWAY)
+	      	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_XA,
+					         icon_size, "GtkTreeView");
+	    else if (prim == GAIM_STATUS_OFFLINE)
+	      	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
+					         icon_size, "GtkTreeView");
+	    else
+	      	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AVAILABLE,
+					         icon_size, "GtkTreeView");
+#if 0
 		if (account_status)
 			pixbuf = gaim_gtk_create_prpl_icon_with_status(acct,
 						gaim_status_get_type(gaim_account_get_active_status(acct)),
@@ -621,6 +647,8 @@
 				g_object_unref(G_OBJECT(emblem));
 			}
 		}
+#endif
+		
 	}
 
 	if (status_box->account != NULL) {
@@ -827,12 +855,27 @@
 		GaimSavedStatus *saved = cur->data;
 		const gchar *message;
 		gchar *stripped = NULL;
+		GaimStatusPrimitive prim;
 
 		/* Get an appropriate status icon */
-		pixbuf = gaim_gtk_create_gaim_icon_with_status(
-					gaim_savedstatus_get_type(saved),
-					0.5);
+	      	prim = gaim_savedstatus_get_type(saved);
 
+            	if (prim == GAIM_STATUS_UNAVAILABLE)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_BUSY,
+                       	        	                  icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_AWAY)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_AWAY,
+                        	                         icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_EXTENDED_AWAY)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_XA,
+                        	                         icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_OFFLINE)
+               		pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_OFFLINE,
+                        	                         icon_size, "GtkTreeView");
+            	else
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_AVAILABLE,
+                        	                         icon_size, "GtkTreeView");
+      
 		if (gaim_savedstatus_is_transient(saved))
 		{
 			/*
@@ -849,7 +892,7 @@
 				stripped = gaim_markup_strip_html(message);
 				gaim_util_chrreplace(stripped, '\n', ' ');
 			}
-
+#if 0
 			/* Overlay a disk in the bottom left corner */
 			emblem = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox),
 						GTK_STOCK_SAVE, icon_size, "GtkGaimStatusBox");
@@ -862,6 +905,7 @@
 							0.5, 0.5, GDK_INTERP_BILINEAR, 255);
 				g_object_unref(G_OBJECT(emblem));
 			}
+#endif
 		}
 
 		gtk_gaim_status_box_add(statusbox, GTK_GAIM_STATUS_BOX_TYPE_POPULAR,
@@ -930,23 +974,42 @@
 {
 	/* Per-account */
 	const GList *l;
-	GdkPixbuf *tmp;
+	GdkPixbuf *pixbuf;
 
 	for (l = gaim_account_get_status_types(account); l != NULL; l = l->next)
 	{
 		GaimStatusType *status_type = (GaimStatusType *)l->data;
+		GaimStatusPrimitive prim;
+		GtkIconSize icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL);
 
 		if (!gaim_status_type_is_user_settable(status_type))
 			continue;
 
-		tmp = gaim_gtk_create_prpl_icon_with_status(account, status_type, 0.5);
+            	prim = gaim_status_type_get_primitive(status_type);
+
+            	if (prim == GAIM_STATUS_UNAVAILABLE)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_BUSY,
+                       		                          icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_AWAY)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY,
+                       		                          icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_EXTENDED_AWAY)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_XA,
+                        	                         icon_size, "GtkTreeView");
+            	else if (prim == GAIM_STATUS_OFFLINE)
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE,
+                        	                         icon_size, "GtkTreeView");
+            	else
+                	pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AVAILABLE,
+                        	                         icon_size, "GtkTreeView");
+
 		gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box),
-					GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, tmp,
+					GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf,
 					gaim_status_type_get_name(status_type),
 					NULL,
 					GINT_TO_POINTER(gaim_status_type_get_primitive(status_type)));
-		if (tmp != NULL)
-			g_object_unref(tmp);
+		if (pixbuf != NULL)
+			g_object_unref(pixbuf);
 	}
 }
 
@@ -1673,7 +1736,8 @@
 	gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, requisition);
 
 	/* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
-	requisition->height = MAX(requisition->height, 32 + (border_width*2));
+	requisition->height = MAX(requisition->height, 34);
+	requisition->height += border_width * 2;
 
 	/* If the gtkimhtml is visible, then add some additional padding */
 	gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req);
@@ -1735,7 +1799,8 @@
 	gtk_widget_size_request(status_box->toggle_button, &req);
 	/* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
 
-	req.height = MAX(req.height, 32 + (border_width*2));
+	req.height = MAX(req.height, 34);
+	req.height += border_width * 2;
 
 	box_alc = *allocation;
 
@@ -1755,16 +1820,16 @@
 	{
 		GtkTextDirection dir = gtk_widget_get_direction(widget);
 		parent_alc.width -= (parent_alc.height + border_width);
-		icon_alc = *allocation;
-		icon_alc.height = MAX(1,req.height) - (border_width*2);
+		icon_alc = parent_alc;
+		icon_alc.height = MAX(1,req.height) - (border_width*2) -2;
 		icon_alc.width = icon_alc.height;
 		if (dir == GTK_TEXT_DIR_RTL) {
 			icon_alc.x = parent_alc.x;
 			parent_alc.x += icon_alc.width + border_width;
 		} else {
-			icon_alc.x = allocation->width - (icon_alc.width + border_width);
+			icon_alc.x = allocation->width - (icon_alc.width + border_width + 1);
 		}
-		icon_alc.y += border_width;
+		icon_alc.y += 1;
 
 		if (status_box->icon_size != icon_alc.height)
 		{
@@ -1773,7 +1838,6 @@
 		}
 		gtk_widget_size_allocate(status_box->icon_box, &icon_alc);
 	}
-
 	gtk_widget_size_allocate(status_box->toggle_button, &parent_alc);
 	widget->allocation = *allocation;
 }
@@ -1785,8 +1849,11 @@
 	GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget);
 	gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event);
 	gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event);
-	if (status_box->icon_box)
-		gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->icon_box, event);
+	if (status_box->icon_box && status_box->icon_opaque) {
+		gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL,
+				status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1,
+				34, 34);
+	}		
 	return FALSE;
 }
 
@@ -1949,9 +2016,11 @@
 	}
 
 	if (status_box->buddy_icon != NULL) {
+	        status_box->icon_opaque = gaim_gdk_pixbuf_is_opaque(status_box->buddy_icon);
 		gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon);
 		status_box->buddy_icon_hover = gdk_pixbuf_copy(status_box->buddy_icon);
 		do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 32);
+		gtk_widget_queue_resize(GTK_WIDGET(status_box));
 	}
 }
 
--- a/pidgin/gtkstatusbox.h	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkstatusbox.h	Thu Jan 25 19:00:52 2007 +0000
@@ -97,7 +97,8 @@
 	GtkWidget *icon_box_menu;
 	GdkCursor *hand_cursor;
 	GdkCursor *arrow_cursor;
-	int icon_size;
+        int icon_size;
+        gboolean icon_opaque;
 
 	gboolean imhtml_visible;
 
--- a/pidgin/gtkutils.c	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkutils.c	Thu Jan 25 19:00:52 2007 +0000
@@ -3124,6 +3124,42 @@
 }
 
 
+gboolean gaim_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf) {
+        int width, height, rowstride, i;
+        unsigned char *pixels;
+        unsigned char *row;
+
+        if (!gdk_pixbuf_get_has_alpha(pixbuf))
+                return TRUE;
+
+        width = gdk_pixbuf_get_width (pixbuf);
+        height = gdk_pixbuf_get_height (pixbuf);
+        rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+        pixels = gdk_pixbuf_get_pixels (pixbuf);
+
+        row = pixels;
+        for (i = 3; i < rowstride; i+=4) {
+                if (row[i] != 0xff)
+                        return FALSE;
+        }
+
+        for (i = 1; i < height - 1; i++) {
+                row = pixels + (i*rowstride);
+                if (row[3] != 0xff || row[rowstride-1] != 0xff) {
+                        printf("0: %d, last: %d\n", row[3], row[rowstride-1]);
+                        return FALSE;
+                }
+        }
+
+        row = pixels + ((height-1) * rowstride);
+        for (i = 3; i < rowstride; i+=4) {
+                if (row[i] != 0xff)
+                        return FALSE;
+        }
+
+        return TRUE;
+}
+
 #if !GTK_CHECK_VERSION(2,2,0)
 GtkTreePath *
 gtk_tree_path_new_from_indices (gint first_index, ...)
--- a/pidgin/gtkutils.h	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/gtkutils.h	Thu Jan 25 19:00:52 2007 +0000
@@ -542,6 +542,15 @@
  */
 void gaim_gtk_set_urgent(GtkWindow *window, gboolean urgent);
 
+/**
+ * Returns TRUE if the GdkPixbuf is opaque, as determined by no
+ * alpha at any of the edge pixels.
+ *
+ * @param pixbuf  The pixbug
+ * @return TRUE if the pixbuf is opaque around the edges, FALSE otherwise
+ */
+gboolean gaim_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf);
+
 #if !GTK_CHECK_VERSION(2,2,0)
 /**
  * This is copied from Gtk to support Gtk 2.0
--- a/pidgin/plugins/perl/common/Makefile.PL.in	Thu Jan 25 19:00:02 2007 +0000
+++ b/pidgin/plugins/perl/common/Makefile.PL.in	Thu Jan 25 19:00:52 2007 +0000
@@ -15,6 +15,6 @@
     # but this breaks running make clean more than once in a row.
     'MAKEFILE_OLD'  => "Makefile",
     'OBJECT'        => '$(O_FILES)',
-    'TYPEMAPS'      => ["@top_srcdir@/libgaim/plugins/perl/common/typemap"],
+    'TYPEMAPS'      => ["@top_srcdir@/libpurple/plugins/perl/common/typemap"],
 #    'OPTIMIZE'      => '-g', # For debugging.
 );