[drwright] Rip out obsolete crap



commit 897b0cdfc1eb9be23ffab4f5fcd643732401995f
Author: Christian Persch <chpe gnome org>
Date:   Mon Feb 28 20:47:48 2011 +0100

    Rip out obsolete crap

 configure.in    |    6 ---
 src/Makefile.am |    5 --
 src/drwright.c  |  118 -------------------------------------------------------
 src/main.c      |    4 --
 4 files changed, 0 insertions(+), 133 deletions(-)
---
diff --git a/configure.in b/configure.in
index 937df04..4d273f2 100644
--- a/configure.in
+++ b/configure.in
@@ -117,12 +117,6 @@ fi
 
 GLIB_GSETTINGS
 
-# *****************
-# Optional features
-# *****************
-
-AM_CONDITIONAL([HAVE_APP_INDICATOR],[false])
-
 # *****
 # GConf
 # *****
diff --git a/src/Makefile.am b/src/Makefile.am
index d3deb59..53b8bd9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,11 +32,6 @@ gnome_typing_monitor_LDADD = \
 	$(SCREENSAVER_LIBS)	\
 	$(INTLLIBS)
 
-if HAVE_APP_INDICATOR
-  gnome_typing_monitor_CFLAGS += -DHAVE_APP_INDICATOR $(APP_INDICATOR_CFLAGS)
-  gnome_typing_monitor_LDADD += $(APP_INDICATOR_LIBS)
-endif
-
 imagedir = $(pkgdatadir)/pixmaps
 dist_image_DATA = bar.png bar-red.png bar-green.png bar-disabled.png ocean-stripes.png
 
diff --git a/src/drwright.c b/src/drwright.c
index 9d41f88..5454847 100644
--- a/src/drwright.c
+++ b/src/drwright.c
@@ -29,21 +29,15 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#ifdef HAVE_APP_INDICATOR
-#include <libappindicator/app-indicator.h>
-#endif /* HAVE_APP_INDICATOR */
-
 #include "drwright.h"
 #include "drw-break-window.h"
 #include "drw-monitor.h"
 #include "drw-utils.h"
 #include "drw-timer.h"
 
-#ifndef HAVE_APP_INDICATOR
 #define BLINK_TIMEOUT        1000
 #define BLINK_TIMEOUT_MIN    500
 #define BLINK_TIMEOUT_FACTOR 100
-#endif /* HAVE_APP_INDICATOR */
 
 #define WARN_TIME_MAX        (3 * 60 /* s */)
 
@@ -62,11 +56,6 @@ typedef enum {
 	STATE_BREAK_DONE
 } DrwState;
 
-#ifdef HAVE_APP_INDICATOR
-#define TYPING_MONITOR_ACTIVE_ICON "bar-green"
-#define TYPING_MONITOR_ATTENTION_ICON "bar-red"
-#endif /* HAVE_APP_INDICATOR */
-
 struct _DrWright {
         GSettings      *settings;
 
@@ -93,9 +82,6 @@ struct _DrWright {
 	gboolean        enabled;
 
 	guint           clock_timeout_id;
-#ifdef HAVE_APP_INDICATOR
-	AppIndicator   *indicator;
-#else
 	guint           blink_timeout_id;
 
 	gboolean        blink_on;
@@ -107,7 +93,6 @@ struct _DrWright {
 	GdkPixbuf      *green_bar;
 	GdkPixbuf      *disabled_bar;
 	GdkPixbuf      *composite_bar;
-#endif /* HAVE_APP_INDICATOR */
 
 	GtkWidget      *warn_dialog;
 };
@@ -129,11 +114,7 @@ static void     popup_preferences_cb           (GtkAction      *action,
 						DrWright       *dr);
 static void     popup_about_cb                 (GtkAction      *action,
 						DrWright       *dr);
-#ifdef HAVE_APP_INDICATOR
-static void     init_app_indicator             (DrWright       *dr);
-#else
 static void     init_tray_icon                 (DrWright       *dr);
-#endif /* HAVE_APP_INDICATOR */
 static GList *  create_secondary_break_windows (void);
 
 static const GtkActionEntry actions[] = {
@@ -152,31 +133,6 @@ setup_debug_values (DrWright *dr)
 	dr->break_time = 60;
 }
 
-#ifdef HAVE_APP_INDICATOR
-static void
-update_app_indicator (DrWright *dr)
-{
-	AppIndicatorStatus new_status;
-
-	if (!dr->enabled) {
-		app_indicator_set_status (dr->indicator,
-					  APP_INDICATOR_STATUS_PASSIVE);
-		return;
-	}
-
-	switch (dr->state) {
-	case STATE_WARN:
-	case STATE_BREAK_SETUP:
-	case STATE_BREAK:
-		new_status = APP_INDICATOR_STATUS_ATTENTION;
-		break;
-	default:
-		new_status = APP_INDICATOR_STATUS_ACTIVE;
-	}
-
-	app_indicator_set_status (dr->indicator, new_status);
-}
-#else
 static void
 update_icon (DrWright *dr)
 {
@@ -293,32 +249,27 @@ blink_timeout_cb (DrWright *dr)
 
 	return FALSE;
 }
-#endif /* HAVE_APP_INDICATOR */
 
 static void
 start_blinking (DrWright *dr)
 {
-#ifndef HAVE_APP_INDICATOR
 	if (!dr->blink_timeout_id) {
 		dr->blink_on = TRUE;
 		blink_timeout_cb (dr);
 	}
 
 	/*gtk_widget_show (GTK_WIDGET (dr->icon));*/
-#endif /* HAVE_APP_INDICATOR */
 }
 
 static void
 stop_blinking (DrWright *dr)
 {
-#ifndef HAVE_APP_INDICATOR
 	if (dr->blink_timeout_id) {
 		g_source_remove (dr->blink_timeout_id);
 		dr->blink_timeout_id = 0;
 	}
 
 	/*gtk_widget_hide (GTK_WIDGET (dr->icon));*/
-#endif /* HAVE_APP_INDICATOR */
 }
 
 static gboolean
@@ -373,10 +324,8 @@ maybe_change_state (DrWright *dr)
 			dr->break_window = NULL;
 		}
 
-#ifndef HAVE_APP_INDICATOR
 		gtk_status_icon_set_from_pixbuf (dr->icon,
 						 dr->neutral_bar);
-#endif /* HAVE_APP_INDICATOR */
 
 		dr->save_last_time = 0;
 
@@ -414,10 +363,8 @@ maybe_change_state (DrWright *dr)
 		}
 
 		stop_blinking (dr);
-#ifndef HAVE_APP_INDICATOR
 		gtk_status_icon_set_from_pixbuf (dr->icon,
 						 dr->red_bar);
-#endif /* HAVE_APP_INDICATOR */
 
 		drw_timer_start (dr->timer);
 
@@ -461,10 +408,8 @@ maybe_change_state (DrWright *dr)
 
 	case STATE_BREAK_DONE_SETUP:
 		stop_blinking (dr);
-#ifndef HAVE_APP_INDICATOR
 		gtk_status_icon_set_from_pixbuf (dr->icon,
 						 dr->green_bar);
-#endif /* HAVE_APP_INDICATOR */
 
 		dr->state = STATE_BREAK_DONE;
 		break;
@@ -480,11 +425,7 @@ maybe_change_state (DrWright *dr)
 
 	dr->last_elapsed_time = elapsed_time;
 
-#ifdef HAVE_APP_INDICATOR
-	update_app_indicator (dr);
-#else
 	update_icon (dr);
-#endif /* HAVE_APP_INDICATOR */
 
 	return TRUE;
 }
@@ -494,45 +435,24 @@ update_status (DrWright *dr)
 {
 	gint       min;
 	gchar     *str;
-#ifdef HAVE_APP_INDICATOR
-	GtkWidget *item;
-#endif /* HAVE_APP_INDICATOR */
 
 	if (!dr->enabled) {
-#ifdef HAVE_APP_INDICATOR
-		app_indicator_set_status (dr->indicator,
-					  APP_INDICATOR_STATUS_PASSIVE);
-#else
 		gtk_status_icon_set_tooltip_text (dr->icon,
 						  _("Disabled"));
-#endif /* HAVE_APP_INDICATOR */
 		return TRUE;
 	}
 
 	min = get_time_left (dr);
 
 	if (min >= 1) {
-#ifdef HAVE_APP_INDICATOR
-		str = g_strdup_printf (_("Take a break now (next in %dm)"), min);
-#else
 		str = g_strdup_printf (ngettext("%d minute until the next break",
 						"%d minutes until the next break",
 						min), min);
-#endif /* HAVE_APP_INDICATOR */
 	} else {
-#ifdef HAVE_APP_INDICATOR
-		str = g_strdup_printf (_("Take a break now (next in less than one minute)"));
-#else
 		str = g_strdup_printf (_("Less than one minute until the next break"));
-#endif /* HAVE_APP_INDICATOR */
 	}
 
-#ifdef HAVE_APP_INDICATOR
-	item = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop/TakeABreak");
-	gtk_menu_item_set_label (GTK_MENU_ITEM (item), str);
-#else
 	gtk_status_icon_set_tooltip_text (dr->icon, str);
-#endif /* HAVE_APP_INDICATOR */
 
 	g_free (str);
 
@@ -666,7 +586,6 @@ popup_about_cb (GtkAction *action, DrWright *dr)
 			       NULL);
 }
 
-#ifndef HAVE_APP_INDICATOR
 static void
 popup_menu_cb (GtkWidget *widget,
 	       guint      button,
@@ -685,7 +604,6 @@ popup_menu_cb (GtkWidget *widget,
 			0,
 			gtk_get_current_event_time ());
 }
-#endif /* HAVE_APP_INDICATOR */
 
 static void
 break_window_done_cb (GtkWidget *window,
@@ -725,11 +643,7 @@ break_window_postpone_cb (GtkWidget *window,
 	drw_timer_start (dr->timer);
 	maybe_change_state (dr);
 	update_status (dr);
-#ifdef HAVE_APP_INDICATOR
-	update_app_indicator (dr);
-#else
 	update_icon (dr);
-#endif /* HAVE_APP_INDICATOR */
 }
 
 static void
@@ -746,33 +660,6 @@ break_window_destroy_cb (GtkWidget *window,
 	dr->secondary_break_windows = NULL;
 }
 
-#ifdef HAVE_APP_INDICATOR
-static void
-init_app_indicator (DrWright *dr)
-{
-	GtkWidget *indicator_menu;
-
-	dr->indicator =
-		app_indicator_new_with_path ("typing-break-indicator",
-					     TYPING_MONITOR_ACTIVE_ICON,
-					     APP_INDICATOR_CATEGORY_APPLICATION_STATUS,
-					     IMAGEDIR);
-	if (dr->enabled) {
-		app_indicator_set_status (dr->indicator,
-					  APP_INDICATOR_STATUS_ACTIVE);
-	} else {
-		app_indicator_set_status (dr->indicator,
-					  APP_INDICATOR_STATUS_PASSIVE);
-	}
-
-	indicator_menu = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop");
-	app_indicator_set_menu (dr->indicator, GTK_MENU (indicator_menu));
-	app_indicator_set_attention_icon (dr->indicator, TYPING_MONITOR_ATTENTION_ICON);
-
-	update_status (dr);
-	update_app_indicator (dr);
-}
-#else
 static void
 init_tray_icon (DrWright *dr)
 {
@@ -786,7 +673,6 @@ init_tray_icon (DrWright *dr)
 			  G_CALLBACK (popup_menu_cb),
 			  dr);
 }
-#endif /* HAVE_APP_INDICATOR */
 
 static GList *
 create_secondary_break_windows (void)
@@ -868,16 +754,12 @@ drwright_new (void)
 			  G_CALLBACK (activity_detected_cb),
 			  dr);
 
-#ifdef HAVE_APP_INDICATOR
-	init_app_indicator (dr);
-#else
 	dr->neutral_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar.png", NULL);
 	dr->red_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-red.png", NULL);
 	dr->green_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-green.png", NULL);
 	dr->disabled_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-disabled.png", NULL);
 
 	init_tray_icon (dr);
-#endif /* HAVE_APP_INDICATOR */
 
 	g_timeout_add_seconds (12,
 			       (GSourceFunc) update_status,
diff --git a/src/main.c b/src/main.c
index 6613cec..3413e23 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,7 +31,6 @@
 
 gboolean debug = FALSE;
 
-#ifndef HAVE_APP_INDICATOR
 static gboolean
 have_tray (void)
 {
@@ -50,7 +49,6 @@ have_tray (void)
 		return FALSE;
 	}
 }
-#endif /* HAVE_APP_INDICATOR */
 
 int
 main (int argc, char *argv[])
@@ -95,7 +93,6 @@ main (int argc, char *argv[])
 		return 0;
 	}
 
-#ifndef HAVE_APP_INDICATOR
 	if (!no_check && !have_tray ()) {
 		GtkWidget *dialog;
 
@@ -113,7 +110,6 @@ main (int argc, char *argv[])
 
 		gtk_widget_destroy (dialog);
 	}
-#endif /* HAVE_APP_INDICATOR */
 	
 	drwright = drwright_new ();
 



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