[patch] nautilus-throbber, bug 95742



Hi,

This patch removes the location stuff (location to open if the throbber
is clicked) from the throbber-component and removes the visual
mouse-over and click feedback.

Regards
	Jan Arne Petersen
Index: components/throbber/nautilus-throbber.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/throbber/nautilus-throbber.c,v
retrieving revision 1.32
diff -u -r1.32 nautilus-throbber.c
--- components/throbber/nautilus-throbber.c	18 Apr 2002 23:35:51 -0000	1.32
+++ components/throbber/nautilus-throbber.c	1 Nov 2002 13:20:47 -0000
@@ -63,9 +63,6 @@
 	
 	gboolean ready;
 	gboolean small_mode;
-
-	gboolean button_in;
-	gboolean button_down;
 };
 
 
@@ -111,18 +108,6 @@
 		break;
 	}
 
-	case LOCATION:
-	{
-		char *location = nautilus_theme_get_theme_data ("throbber", "url");
-		if (location != NULL) {
-			BONOBO_ARG_SET_STRING (arg, location);
-			g_free (location);
-		} else {
-			BONOBO_ARG_SET_STRING (arg, "");			
-		}
-		
-	}
-
 		default:
 			g_warning ("Unhandled arg %d", arg_id);
 			break;
@@ -246,8 +231,6 @@
 
 	bonobo_property_bag_add (throbber->details->property_bag, "throbbing", THROBBING, BONOBO_ARG_BOOLEAN, NULL,
 				 "Throbber active", 0);
-	bonobo_property_bag_add (throbber->details->property_bag, "location", LOCATION, BONOBO_ARG_STRING, NULL,
-				 "associated URL", 0);
 	bonobo_property_bag_add (throbber->details->property_bag, "style", STYLE, BONOBO_ARG_INT, NULL, NULL,
 				 Bonobo_PROPERTY_WRITEABLE);
 	nautilus_throbber_load_images (throbber);
@@ -298,7 +281,7 @@
 nautilus_throbber_expose (GtkWidget *widget, GdkEventExpose *event)
 {
 	NautilusThrobber *throbber;
-	GdkPixbuf *pixbuf, *massaged_pixbuf;
+	GdkPixbuf *pixbuf;
 	int x_offset, y_offset, width, height;
 	GdkRectangle pix_area, dest;
 
@@ -314,17 +297,6 @@
 		return FALSE;
 	}
 
-	/* Get the right tint on the image */
-	if (throbber->details->button_in) {
-		if (throbber->details->button_down) {
-			massaged_pixbuf = eel_create_darkened_pixbuf (pixbuf, 0.8 * 255, 0.8 * 255);
-		} else {
-			massaged_pixbuf = eel_create_spotlight_pixbuf (pixbuf);
-		}
-		g_object_unref (pixbuf);
-		pixbuf = massaged_pixbuf;
-	}
-
 	width = gdk_pixbuf_get_width (pixbuf);
 	height = gdk_pixbuf_get_height (pixbuf);
 
@@ -535,97 +507,6 @@
 	g_free (image_theme);
 }
 
-static gboolean
-nautilus_throbber_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event)
-{
-	NautilusThrobber *throbber;
-
-	throbber = NAUTILUS_THROBBER (widget);
-
-	if (!throbber->details->button_in) {
-		throbber->details->button_in = TRUE;
-		gtk_widget_queue_draw (widget);
-	}
-
-	return GNOME_CALL_PARENT_WITH_DEFAULT
-		(GTK_WIDGET_CLASS, enter_notify_event, (widget, event), FALSE);
-}
-
-static gboolean
-nautilus_throbber_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event)
-{
-	NautilusThrobber *throbber;
-
-	throbber = NAUTILUS_THROBBER (widget);
-
-	if (throbber->details->button_in) {
-		throbber->details->button_in = FALSE;
-		gtk_widget_queue_draw (widget);
-	}
-
-	return GNOME_CALL_PARENT_WITH_DEFAULT
-		(GTK_WIDGET_CLASS, leave_notify_event, (widget, event), FALSE);
-}
-
-/* handle button presses by posting a change on the "location" property */
-
-static gboolean
-nautilus_throbber_button_press_event (GtkWidget *widget, GdkEventButton *event)
-{
-	NautilusThrobber *throbber;
-
-	throbber = NAUTILUS_THROBBER (widget);
-
-	if (event->button == 1) {
-		throbber->details->button_down = TRUE;
-		throbber->details->button_in = TRUE;
-		gtk_widget_queue_draw (widget);
-		return TRUE;
-	}
-
-	return GNOME_CALL_PARENT_WITH_DEFAULT
-		(GTK_WIDGET_CLASS, button_press_event, (widget, event), FALSE);
-}
-
-static void
-nautilus_throbber_set_location (NautilusThrobber *throbber)
-{
-	char *location;
-	BonoboArg *location_arg;
-
-	location = nautilus_theme_get_theme_data ("throbber", "url");
-	if (location != NULL) {
-		location_arg = bonobo_arg_new (BONOBO_ARG_STRING);
-		BONOBO_ARG_SET_STRING (location_arg, location);
-		bonobo_event_source_notify_listeners_full (
-			throbber->details->property_bag->es,
-			"Bonobo/Property", "change", "location",
-			location_arg, NULL);
-		bonobo_arg_release (location_arg);
-		g_free (location);
-	}
-}
-
-static gboolean
-nautilus_throbber_button_release_event (GtkWidget *widget, GdkEventButton *event)
-{	
-	NautilusThrobber *throbber;
-	
-	throbber = NAUTILUS_THROBBER (widget);
-
-	if (event->button == 1) {
-		if (throbber->details->button_in) {
-			nautilus_throbber_set_location (throbber);
-		}
-		throbber->details->button_down = FALSE;
-		gtk_widget_queue_draw (widget);
-		return TRUE;
-	}
-	
-	return GNOME_CALL_PARENT_WITH_DEFAULT
-		(GTK_WIDGET_CLASS, button_release_event, (widget, event), FALSE);
-}
-
 void
 nautilus_throbber_set_small_mode (NautilusThrobber *throbber, gboolean new_mode)
 {
@@ -684,10 +565,6 @@
 	G_OBJECT_CLASS (class)->finalize = nautilus_throbber_finalize;
 
 	widget_class->expose_event = nautilus_throbber_expose;
-	widget_class->button_press_event = nautilus_throbber_button_press_event;
-	widget_class->button_release_event = nautilus_throbber_button_release_event;
-	widget_class->enter_notify_event = nautilus_throbber_enter_notify_event;
-	widget_class->leave_notify_event = nautilus_throbber_leave_notify_event;
 	widget_class->size_request = nautilus_throbber_size_request;	
 	widget_class->map = nautilus_throbber_map;
 	widget_class->get_accessible = nautilus_throbber_get_accessible;
@@ -735,94 +612,6 @@
 	iface->get_image_size = nautilus_throbber_accessible_image_get_size;
 }
 
-/* AtkAction interface */
-
-enum {
-	ACTION_ACTIVATE,
-	LAST_ACTION
-};
-
-static const char *nautilus_throbber_accessible_action_names[] = {
-	"activate",
-	NULL
-};
-
-static const char *nautilus_throbber_accessible_action_descriptions[] = {
-	"Activate selected items",
-	NULL
-};
-
-
-static gboolean
-nautilus_throbber_accessible_do_action (AtkAction *accessible, int i)
-{
-	GtkWidget *widget;
-
-	g_return_val_if_fail (i < LAST_ACTION, FALSE);
-
-	widget = GTK_ACCESSIBLE (accessible)->widget;
-	if (!widget) {
-		return FALSE;
-	}
-	
-	switch (i) {
-	case ACTION_ACTIVATE :
-		nautilus_throbber_set_location (NAUTILUS_THROBBER (widget));
-		return TRUE;
-	default:
-		return FALSE;
-	}
-}
-
-static int
-nautilus_throbber_accessible_get_n_actions (AtkAction *accessible)
-{
-	return LAST_ACTION;
-}
-
-static const char *
-nautilus_throbber_accessible_action_get_description (AtkAction *accessible, 
-							   int i)
-{
-	g_return_val_if_fail (i < LAST_ACTION, NULL);
-
-	return nautilus_throbber_accessible_action_descriptions[i];
-}
-
-static const char *
-nautilus_throbber_accessible_action_get_name (AtkAction *accessible, int i)
-{
-	g_return_val_if_fail (i < LAST_ACTION, NULL);
-
-	return nautilus_throbber_accessible_action_names [i];
-}
-
-static const char *
-nautilus_throbber_accessible_action_get_keybinding (AtkAction *accessible, 
-						    int        i)
-{
-	return NULL;
-}
-
-static gboolean
-nautilus_throbber_accessible_action_set_description (AtkAction  *accessible, 
-						     int         i, 
-						     const char *description)
-{
-	return FALSE;
-}
-
-static void
-nautilus_throbber_accessible_action_interface_init (AtkActionIface *iface)
-{
-	iface->do_action = nautilus_throbber_accessible_do_action;
-	iface->get_n_actions = nautilus_throbber_accessible_get_n_actions;
-	iface->get_description = nautilus_throbber_accessible_action_get_description;
-	iface->get_name = nautilus_throbber_accessible_action_get_name;
-	iface->get_keybinding = nautilus_throbber_accessible_action_get_keybinding;
-	iface->set_description = nautilus_throbber_accessible_action_set_description;
-}
-
 static GType
 nautilus_throbber_accessible_get_type (void)
 {
@@ -831,12 +620,6 @@
 	/* Action interface
 	   Name etc. ... */
         if (!type) {
-                static GInterfaceInfo atk_action_info = {
-                        (GInterfaceInitFunc) nautilus_throbber_accessible_action_interface_init,
-                        (GInterfaceFinalizeFunc) NULL,
-                        NULL
-                };              
-
 		static const GInterfaceInfo atk_image_info = {
 			(GInterfaceInitFunc) nautilus_throbber_accessible_image_interface_init,
 			(GInterfaceFinalizeFunc) NULL,
@@ -848,8 +631,6 @@
 			 GTK_TYPE_IMAGE,
 			 nautilus_throbber_accessible_class_init);
 		
-                g_type_add_interface_static (type, ATK_TYPE_ACTION,
-                                             &atk_action_info);
                 g_type_add_interface_static (type, ATK_TYPE_IMAGE,
                                              &atk_image_info);
         }
Index: src/nautilus-window-toolbars.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-toolbars.c,v
retrieving revision 1.104
diff -u -r1.104 nautilus-window-toolbars.c
--- src/nautilus-window-toolbars.c	24 May 2002 21:54:04 -0000	1.104
+++ src/nautilus-window-toolbars.c	1 Nov 2002 13:20:48 -0000
@@ -289,47 +289,6 @@
 	return item;
 }
 
-static gboolean
-location_change_at_idle_callback (gpointer callback_data)
-{
-	NautilusWindow *window;
-	char *location;
-
-	window = NAUTILUS_WINDOW (callback_data);
-
-	location = window->details->location_to_change_to_at_idle;
-	window->details->location_to_change_to_at_idle = NULL;
-	window->details->location_change_at_idle_id = 0;
-
-	nautilus_window_go_to (window, location);
-	g_free (location);
-
-	return FALSE;
-}
-
-/* handle bonobo events from the throbber -- since they can come in at
-   any time right in the middle of things, defer until idle */
-static void 
-throbber_callback (BonoboListener *listener,
-		   const char *event_name, 
-		   const CORBA_any *arg,
-		   CORBA_Environment *ev,
-		   gpointer callback_data)
-{
-	NautilusWindow *window;
-
-	window = NAUTILUS_WINDOW (callback_data);
-
-	g_free (window->details->location_to_change_to_at_idle);
-	window->details->location_to_change_to_at_idle = g_strdup (
-		BONOBO_ARG_GET_STRING (arg));
-
-	if (window->details->location_change_at_idle_id == 0) {
-		window->details->location_change_at_idle_id =
-			gtk_idle_add (location_change_at_idle_callback, window);
-	}
-}
-
 static void
 throbber_set_throbbing (NautilusWindow *window,
 			gboolean        throbbing)
@@ -381,12 +340,6 @@
 	} else {
 		throbber_set_throbbing (window, window->details->throbber_active);
 	}
-
-	window->details->throbber_listener =
-		bonobo_event_source_client_add_listener_full
-		(window->details->throbber_property_bag,
-		 g_cclosure_new (G_CALLBACK (throbber_callback), window, NULL), 
-		 "Bonobo/Property:change:location", ev);
 
 	bonobo_object_release_unref (throbber, ev);
 
Index: src/nautilus-window-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-private.h,v
retrieving revision 1.92
diff -u -r1.92 nautilus-window-private.h
--- src/nautilus-window-private.h	22 Sep 2002 17:18:44 -0000	1.92
+++ src/nautilus-window-private.h	1 Nov 2002 13:20:48 -0000
@@ -87,7 +87,6 @@
         gboolean           throbber_active;
         gboolean           throbber_activating;
 	Bonobo_PropertyBag throbber_property_bag;
-	Bonobo_Listener    throbber_listener;
 
         /* Deferred location change. */
         char *location_to_change_to_at_idle;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]