diff options
author | Ted Gould <ted@canonical.com> | 2008-12-03 19:26:50 -0800 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2008-12-03 19:26:50 -0800 |
commit | e1092dabd7b0642bdba407780fd78a494a920233 (patch) | |
tree | 65ceb1bfb5759e0f863abb4921cdc3d0f9fa7a36 /src | |
parent | a387d91c169cb0add2cee70c66ae2c465bc341eb (diff) | |
download | libayatana-indicator-e1092dabd7b0642bdba407780fd78a494a920233.tar.gz libayatana-indicator-e1092dabd7b0642bdba407780fd78a494a920233.tar.bz2 libayatana-indicator-e1092dabd7b0642bdba407780fd78a494a920233.zip |
Removing everything except messaging.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 14 | ||||
-rw-r--r-- | src/applet-main.c | 8 | ||||
-rw-r--r-- | src/indicator-audio.c | 45 | ||||
-rw-r--r-- | src/indicator-audio.h | 10 | ||||
-rw-r--r-- | src/indicator-network.c | 11 | ||||
-rw-r--r-- | src/indicator-network.h | 10 | ||||
-rw-r--r-- | src/indicator-power.c | 108 | ||||
-rw-r--r-- | src/indicator-power.h | 10 | ||||
-rw-r--r-- | src/indicator-system.c | 11 | ||||
-rw-r--r-- | src/indicator-system.h | 10 | ||||
-rw-r--r-- | src/menu-dbus.c | 80 | ||||
-rw-r--r-- | src/menu-dbus.h | 17 | ||||
-rw-r--r-- | src/slidermenuitem.c | 86 | ||||
-rw-r--r-- | src/slidermenuitem.h | 59 |
14 files changed, 1 insertions, 478 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index dff09f5..648c764 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,20 +9,8 @@ indicator_applet_CFLAGS = \ indicator_applet_SOURCES = \ applet-main.c \ - indicator-audio.c \ - indicator-audio.h \ indicator-messages.c \ - indicator-messages.h \ - indicator-network.c \ - indicator-network.h \ - indicator-power.c \ - indicator-power.h \ - indicator-system.c \ - indicator-system.h \ - menu-dbus.c \ - menu-dbus.h \ - slidermenuitem.c \ - slidermenuitem.h + indicator-messages.h indicator_applet_LDADD = \ $(APPLET_LIBS) diff --git a/src/applet-main.c b/src/applet-main.c index f442d09..31204df 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -1,11 +1,7 @@ #include <panel-applet.h> -#include "indicator-audio.h" #include "indicator-messages.h" -#include "indicator-network.h" -#include "indicator-power.h" -#include "indicator-system.h" #define ICONS_DIR (DATADIR G_DIR_SEPARATOR_S "indicator-applet" G_DIR_SEPARATOR_S "icons") @@ -24,11 +20,7 @@ PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", typedef GtkWidget * (*menuitem_func) (void); menuitem_func indicators[] = { - indicator_audio_menuitem, indicator_messages_menuitem, - indicator_network_menuitem, - indicator_power_menuitem, - indicator_system_menuitem, NULL }; diff --git a/src/indicator-audio.c b/src/indicator-audio.c deleted file mode 100644 index 5cf2ac3..0000000 --- a/src/indicator-audio.c +++ /dev/null @@ -1,45 +0,0 @@ - -#include <gtk/gtk.h> -#include "slidermenuitem.h" -#include "indicator-audio.h" - - -GtkWidget * -indicator_audio_menuitem (void) -{ - GtkWidget * mainmenu = gtk_menu_item_new(); - - GtkWidget * icon = gtk_image_new_from_icon_name("panel-light-audio-volume-low", - GTK_ICON_SIZE_MENU); - - gtk_container_add(GTK_CONTAINER(mainmenu), icon); - gtk_widget_show(icon); - - GtkWidget * menu = gtk_menu_new(); - - GtkWidget * item = gtk_menu_item_new_with_label("Mute All"); - gtk_menu_append(GTK_MENU(menu), item); - gtk_widget_show(item); - - item = gtk_menu_item_new_with_label("Sound Settings..."); - gtk_menu_append(GTK_MENU(menu), item); - gtk_widget_show(item); - - GtkWidget * sep = gtk_separator_menu_item_new(); - gtk_menu_append(GTK_MENU(menu), sep); - gtk_widget_show(sep); - - item = slider_menu_item_new("Speakers:", 0.0, 1.0, 0.02); - gtk_menu_append(GTK_MENU(menu), item); - gtk_widget_show(item); - - item = slider_menu_item_new("Headphones:", 0.0, 1.0, 0.02); - gtk_menu_append(GTK_MENU(menu), item); - gtk_widget_show(item); - - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mainmenu), menu); - gtk_widget_show(menu); - - return mainmenu; -} - diff --git a/src/indicator-audio.h b/src/indicator-audio.h deleted file mode 100644 index a9c0311..0000000 --- a/src/indicator-audio.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef INDICATOR_AUDIO_H__SEEN__ -#define INDICATOR_AUDIO_H__SEEN__ 1 - - -GtkWidget * indicator_audio_menuitem (void); - - - -#endif /* INDICATOR_AUDIO_H__SEEN__ */ diff --git a/src/indicator-network.c b/src/indicator-network.c deleted file mode 100644 index a0492d4..0000000 --- a/src/indicator-network.c +++ /dev/null @@ -1,11 +0,0 @@ - -#include <gtk/gtk.h> -#include "indicator-network.h" - -GtkWidget * -indicator_network_menuitem (void) -{ - - return NULL; -} - diff --git a/src/indicator-network.h b/src/indicator-network.h deleted file mode 100644 index 18c8096..0000000 --- a/src/indicator-network.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef INDICATOR_NETWORK_H__SEEN__ -#define INDICATOR_NETWORK_H__SEEN__ 1 - - -GtkWidget * indicator_network_menuitem (void); - - - -#endif /* INDICATOR_NETWORK_H__SEEN__ */ diff --git a/src/indicator-power.c b/src/indicator-power.c deleted file mode 100644 index 84d5da1..0000000 --- a/src/indicator-power.c +++ /dev/null @@ -1,108 +0,0 @@ - -#include <gtk/gtk.h> -#include <glib/gi18n.h> -#include "indicator-power.h" - -typedef struct { - char * label; - char * icon; - char * time; -} menuitem_t; - -static void -block_prelight (GtkWidget * widget, GtkStateType prev, gpointer data) -{ - if (GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) { - gtk_widget_set_state(widget, prev); - } - return; -} - - -#define MENU_ITEM_CNT 3 -menuitem_t menuitems[MENU_ITEM_CNT] = { - {"Main", "panel-light-power-battery-medium", "(1:34 left)"}, - {"Mouse", "panel-light-power-mouse-verylow", "(0:40 left)"}, - {"Phone", "panel-light-power-battery-verylow", "(10:40 left)"} -}; - -GtkWidget * -power_menu (void) -{ - GtkMenu * menu = GTK_MENU(gtk_menu_new()); - - GtkSizeGroup * icons = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkSizeGroup * labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - GtkSizeGroup * times = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - - int i; - for (i = 0 ; i < MENU_ITEM_CNT; i++) { - GtkWidget * item = gtk_menu_item_new (); - g_signal_connect(G_OBJECT(item), "state-changed", G_CALLBACK(block_prelight), NULL); - - GtkWidget * hbox = gtk_hbox_new (FALSE, 3); - - GtkWidget * icon = gtk_image_new_from_icon_name(menuitems[i].icon, GTK_ICON_SIZE_MENU); - gtk_size_group_add_widget(icons, icon); - gtk_misc_set_alignment(GTK_MISC(icon), 0.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); - gtk_widget_show(icon); - - GtkWidget * label = gtk_label_new(menuitems[i].label); - gtk_size_group_add_widget(labels, label); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 3); - gtk_widget_show(label); - - GtkWidget * time = gtk_label_new(menuitems[i].time); - gtk_size_group_add_widget(times, time); - gtk_misc_set_alignment(GTK_MISC(time), 0.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), time, FALSE, FALSE, 8); - gtk_widget_show(time); - - gtk_container_add(GTK_CONTAINER(item), hbox); - gtk_widget_show(hbox); - - gtk_menu_append(menu, item); - gtk_widget_show(item); - } - - GtkWidget * sep = gtk_separator_menu_item_new(); - gtk_menu_append(menu, sep); - gtk_widget_show(sep); - - GtkWidget * prefs = gtk_menu_item_new_with_label(_("Power Settings...")); - gtk_menu_append(menu, prefs); - gtk_widget_show(prefs); - - return GTK_WIDGET(menu); -} - -GtkWidget * -indicator_power_menuitem (void) -{ - GtkWidget * mainmenu = gtk_menu_item_new(); - - GtkWidget * hbox = gtk_hbox_new(FALSE, 0); - - GtkWidget * icon = gtk_image_new_from_icon_name("panel-light-power-battery-plugged", - GTK_ICON_SIZE_MENU); - gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); - gtk_widget_show(icon); - - GtkWidget * label = gtk_label_new("2:30"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - gtk_container_add(GTK_CONTAINER(mainmenu), hbox); - gtk_widget_show(hbox); - - GtkWidget * submenu = power_menu(); - if (submenu != NULL) { - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mainmenu), submenu); - gtk_widget_show(submenu); - } - - return mainmenu; -} - diff --git a/src/indicator-power.h b/src/indicator-power.h deleted file mode 100644 index a0e7f10..0000000 --- a/src/indicator-power.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef INDICATOR_POWER_H__SEEN__ -#define INDICATOR_POWER_H__SEEN__ 1 - - -GtkWidget * indicator_power_menuitem (void); - - - -#endif /* INDICATOR_POWER_H__SEEN__ */ diff --git a/src/indicator-system.c b/src/indicator-system.c deleted file mode 100644 index 2bd90ee..0000000 --- a/src/indicator-system.c +++ /dev/null @@ -1,11 +0,0 @@ - -#include <gtk/gtk.h> -#include "indicator-system.h" - -GtkWidget * -indicator_system_menuitem (void) -{ - - return NULL; -} - diff --git a/src/indicator-system.h b/src/indicator-system.h deleted file mode 100644 index e900b85..0000000 --- a/src/indicator-system.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef INDICATOR_SYSTEM_H__SEEN__ -#define INDICATOR_SYSTEM_H__SEEN__ 1 - - -GtkWidget * indicator_system_menuitem (void); - - - -#endif /* INDICATOR_SYSTEM_H__SEEN__ */ diff --git a/src/menu-dbus.c b/src/menu-dbus.c deleted file mode 100644 index 1fea066..0000000 --- a/src/menu-dbus.c +++ /dev/null @@ -1,80 +0,0 @@ - -#include "menu-dbus.h" - -GtkWidget * -_dbus_menu_make_menuitem_val (DBusGProxy * proxy, guint id) -{ - GError * error = NULL; - gboolean proxyret; - - gchar * label; - gchar * tooltip; - gchar * icon; - gchar * indicator; - guint submenu; - - /* TODO: switch to begin_call */ - proxyret = dbus_g_proxy_call (proxy, "GetItem", &error, - G_TYPE_UINT, id, - G_TYPE_INVALID, - G_TYPE_STRING, &label, - G_TYPE_STRING, &tooltip, - G_TYPE_STRING, &icon, - G_TYPE_STRING, &indicator, - G_TYPE_UINT, &submenu, - G_TYPE_INVALID); - - if (!proxyret) { - /* TODO: clear error */ - return NULL; - } - - - -} - -GtkWidget * -_dbus_menu_make_menuitem_recurse (DBusGProxy * proxy, guint id) -{ - GError * error = NULL; - GArray * items = NULL; - gboolean proxyret; - - /* TODO: switch to begin_call */ - proxyret = dbus_g_proxy_call (proxy, "GetSubmenuItems", &error, - G_TYPE_UINT, id, - G_TYPE_INVALID, - DBUS_TYPE_G_UINT_ARRAY, &items, - G_TYPE_INVALID); - - if (!proxyret) { - /* TODO: clear error */ - return NULL; - } - - GtkWidget * menu = gtk_menu_new(); - gint i; - for (i = 0; i < items->len; i++) { - guint id = g_array_index(items, guint, i); - GtkWidget * item = _dbus_menu_make_menuitem_val(proxy, id); - if (item != NULL) { - gtk_menu_append(menu, item); - gtk_widget_show(item); - } - } - - return menu; -} - -GtkWidget * -dbus_menu_make_menuitem (DBusGConnection * bus, const char * name, const char * object, guint menu_id) -{ - DBusGProxy * iface = dbus_g_proxy_new_for_name_owner (bus, name, object, "com.canonical.menu", NULL); - if (iface == NULL) { - return NULL; - } - - return _dbus_menu_make_menuitem_recurse(iface, menu_id); -} - - diff --git a/src/menu-dbus.h b/src/menu-dbus.h deleted file mode 100644 index 3b7ed8e..0000000 --- a/src/menu-dbus.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef MENU_DBUS_H__SEEN__ -#define MENU_DBUS_H__SEEN__ 1 - -#include <gtk/gtk.h> -#include <dbus/dbus-glib.h> - -#define DBUS_MENU_ROOT_ID (0) - -GtkWidget * dbus_menu_make_menuitem (DBusGConnection * bus, - const char * name, - const char * object, - guint menu_id); - - - -#endif /* MENU_DBUS_H__SEEN__ */ diff --git a/src/slidermenuitem.c b/src/slidermenuitem.c deleted file mode 100644 index e0dd35e..0000000 --- a/src/slidermenuitem.c +++ /dev/null @@ -1,86 +0,0 @@ - -#include "slidermenuitem.h" - -/* *** Enums *** */ - -enum { - VALUE_CHANGED, - LAST_SIGNAL -}; - -enum { - PROP_0, -}; - -/* *** Prototypes *** */ - - - -/* *** globals *** */ - -static guint slider_menu_item_signals[LAST_SIGNAL] = {0}; - -G_DEFINE_TYPE (SliderMenuItem, slider_menu_item, GTK_TYPE_MENU_ITEM) - -void -slider_menu_item_init (SliderMenuItem * smi) -{ - - return; -} - -static void -slider_menu_item_class_init (SliderMenuItemClass * klass) -{ - GtkMenuItemClass * mic = GTK_MENU_ITEM_CLASS(klass); - - mic->hide_on_activate = FALSE; - mic->activate = NULL; - - return; -} - -GtkWidget * -slider_menu_item_new (const gchar * label, gdouble min, gdouble max, gdouble step) -{ - GtkWidget * smi; - - smi = g_object_new(TYPE_SLIDER_MENU_ITEM, NULL); - - GtkWidget * label_hbox = gtk_hbox_new(FALSE, 12); - - /* Note: look into gtk_accel_label */ - GtkWidget * wlabel = gtk_label_new(label); - gtk_box_pack_start(GTK_BOX(label_hbox), wlabel, TRUE, FALSE, 0); - gtk_widget_show(wlabel); - - GtkWidget * slider_hbox = gtk_hbox_new(FALSE, 3); - - GtkWidget * mute_button = gtk_button_new(); - GtkWidget * mute_icon = gtk_image_new_from_icon_name("audio-volume-low", GTK_ICON_SIZE_MENU); - gtk_container_add(GTK_CONTAINER(mute_button), mute_icon); - gtk_widget_show(mute_icon); - gtk_box_pack_start(GTK_BOX(slider_hbox), mute_button, FALSE, FALSE, 3); - gtk_widget_show(mute_button); - - GtkWidget * scale = gtk_hscale_new_with_range(min, max, step); - gtk_scale_set_digits(GTK_SCALE(scale), 2); - gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE); - gtk_box_pack_start(GTK_BOX(slider_hbox), scale, TRUE, TRUE, 3); - gtk_widget_show(scale); - - GtkWidget * max_button = gtk_button_new(); - GtkWidget * max_icon = gtk_image_new_from_icon_name("audio-volume-high", GTK_ICON_SIZE_MENU); - gtk_container_add(GTK_CONTAINER(max_button), max_icon); - gtk_widget_show(max_icon); - gtk_box_pack_start(GTK_BOX(slider_hbox), max_button, FALSE, FALSE, 3); - gtk_widget_show(max_button); - - gtk_box_pack_start(GTK_BOX(label_hbox), slider_hbox, TRUE, TRUE, 0); - gtk_widget_show(slider_hbox); - - gtk_container_add(GTK_CONTAINER(smi), label_hbox); - gtk_widget_show(label_hbox); - - return smi; -} diff --git a/src/slidermenuitem.h b/src/slidermenuitem.h deleted file mode 100644 index 7a560d2..0000000 --- a/src/slidermenuitem.h +++ /dev/null @@ -1,59 +0,0 @@ - -#ifndef SLIDER_MENU_ITEM_H__ -#define SLIDER_MENU_ITEM_H__ - -#include <gtk/gtk.h> -#include <gtk/gtkmenuitem.h> - -G_BEGIN_DECLS - -#define TYPE_SLIDER_MENU_ITEM (slider_menu_item_get_type()) -#define SLIDER_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST((o), TYPE_SLIDER_MENU_ITEM), SliderMenuItem) -#define SLIDER_MENU_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_SLIDER_MENU_ITEM), SliderMenuItemClass) -#define IS_SLIDER_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), TYPE_SLIDER_MENU_ITEM)) -#define IS_SLIDER_MENU_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), TYPE_SLIDER_MENU_ITEM)) -#define SLIDER_MENU_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_SLIDER_MENU_ITEM), SliderMenuItemClass) - -typedef struct _SliderMenuItem SliderMenuItem; -typedef struct _SliderMenuItemClass SliderMenuItemClass; - -struct _SliderMenuItem -{ - GtkMenuItem menu_item; - - GtkWidget * label; - GtkWidget * slider; - GtkWidget * button_up; - GtkWidget * button_down; -}; - -struct _SliderMenuItemClass -{ - GtkMenuItemClass parent_class; - - /* Everyone else does this :) */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -}; - - -GType slider_menu_item_get_type (void) G_GNUC_CONST; -GtkWidget * slider_menu_item_new (const gchar * label, - gdouble min, - gdouble max, - gdouble step); -GtkWidget * slider_menu_get_plus_button (SliderMenuItem * smi); -GtkWidget * slider_menu_get_minus_button (SliderMenuItem * smi); -GtkAdjustment * slider_menu_get_adjustment (SliderMenuItem * smi); -gdouble slider_menu_get_value (SliderMenuItem * smi); -void slider_menu_set_value (SliderMenuItem * smi, - gdouble value); -void slider_menu_slider_size_group (SliderMenuItem * smi, - GtkSizeGroup * size_group); - -G_END_DECLS - -#endif /* GTK_SLIDER_MENU_ITEM_H__ */ - |