summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/clock/calendar-window.c12
-rw-r--r--applets/wncklet/window-list-menu.xml2
-rw-r--r--applets/wncklet/window-list.c69
3 files changed, 76 insertions, 7 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index d675f492..062e4d7e 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -108,9 +108,9 @@ struct _CalendarWindowPrivate {
GtkTreeModelFilter *birthdays_filter;
GtkTreeModelFilter *tasks_filter;
GtkTreeModelFilter *weather_filter;
+#endif /* HAVE_LIBECAL */
MateConfClient *mateconfclient;
-#endif /* HAVE_LIBECAL */
};
G_DEFINE_TYPE (CalendarWindow, calendar_window, GTK_TYPE_WINDOW)
@@ -1341,6 +1341,7 @@ setup_list_size_constraint (GtkWidget *widget,
G_CALLBACK (constrain_list_size), constraint,
(GClosureNotify) g_free, 0);
}
+#endif /* HAVE_LIBECAL */
static void
expander_activated (GtkExpander *expander,
@@ -1414,7 +1415,6 @@ connect_expander_with_mateconf (CalendarWindow *calwin,
g_object_set_data_full (G_OBJECT (expander), "listener-id",
GUINT_TO_POINTER (listener), remove_listener);
}
-#endif /* HAVE_LIBECAL */
static void
calendar_window_pack_pim (CalendarWindow *calwin,
@@ -1635,9 +1635,7 @@ create_hig_frame (CalendarWindow *calwin,
g_signal_connect_swapped (button, "clicked", callback, calwin);
}
-#ifdef HAVE_LIBECAL
connect_expander_with_mateconf (calwin, expander, key);
-#endif
return vbox;
}
@@ -1810,11 +1808,11 @@ calendar_window_set_property (GObject *object,
static void
calendar_window_destroy (GtkObject *object)
{
-#ifdef HAVE_LIBECAL
CalendarWindow *calwin;
calwin = CALENDAR_WINDOW (object);
+#ifdef HAVE_LIBECAL
if (calwin->priv->client)
g_object_unref (calwin->priv->client);
calwin->priv->client = NULL;
@@ -1842,11 +1840,11 @@ calendar_window_destroy (GtkObject *object)
if (calwin->priv->weather_filter)
g_object_unref (calwin->priv->weather_filter);
calwin->priv->weather_filter = NULL;
+#endif /* HAVE_LIBECAL */
if (calwin->priv->mateconfclient)
g_object_unref (calwin->priv->mateconfclient);
calwin->priv->mateconfclient = NULL;
-#endif /* HAVE_LIBECAL */
GTK_OBJECT_CLASS (calendar_window_parent_class)->destroy (object);
}
@@ -1939,8 +1937,8 @@ calendar_window_init (CalendarWindow *calwin)
#ifdef HAVE_LIBECAL
calwin->priv->previous_selection = NULL;
- calwin->priv->mateconfclient = mateconf_client_get_default ();
#endif
+ calwin->priv->mateconfclient = mateconf_client_get_default ();
}
GtkWidget *
diff --git a/applets/wncklet/window-list-menu.xml b/applets/wncklet/window-list-menu.xml
index 008d382d..615ed655 100644
--- a/applets/wncklet/window-list-menu.xml
+++ b/applets/wncklet/window-list-menu.xml
@@ -1,3 +1,5 @@
+<menuitem name="Tasklist System Monitor Item" action="TasklistSystemMonitor" />
+<separator/>
<menuitem name="Tasklist Preferences Item" action="TasklistPreferences" />
<menuitem name="Tasklist Help Item" action="TasklistHelp" />
<menuitem name="Tasklist About Item" action="TasklistAbout" />
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index edde537d..a7ed6197 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -64,6 +64,7 @@ typedef struct {
guint listeners [3];
} TasklistData;
+static void callSystemMonitor(GtkAction* action, TasklistData* tasklist);
static void display_properties_dialog(GtkAction* action, TasklistData* tasklist);
static void display_help_dialog(GtkAction* action, TasklistData* tasklist);
static void display_about_dialog(GtkAction* action, TasklistData* tasklist);
@@ -170,8 +171,23 @@ static void destroy_tasklist(GtkWidget* widget, TasklistData* tasklist)
g_free(tasklist);
}
+/* TODO: this is sad, should be used a function to retrieve applications from
+ * .desktop or some like that. */
+static const char* listOfSystemMonitors[] = {
+ "mate-system-monitor",
+ "gnome-system-monitor",
+};
+
static const GtkActionEntry tasklist_menu_actions[] = {
{
+ "TasklistSystemMonitor",
+ "utilities-system-monitor",
+ N_("_System Monitor"),
+ NULL,
+ NULL,
+ G_CALLBACK(callSystemMonitor)
+ },
+ {
"TasklistPreferences",
GTK_STOCK_PROPERTIES,
N_("_Preferences"),
@@ -525,6 +541,34 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
action_group = gtk_action_group_new("Tasklist Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, tasklist_menu_actions, G_N_ELEMENTS(tasklist_menu_actions), tasklist);
+
+
+ /* disable the item of system monitor, if not exists.
+ * example, mate-system-monitor, o gnome-system-monitor */
+ char* programpath;
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS(listOfSystemMonitors); i += 1)
+ {
+ programpath = g_find_program_in_path(listOfSystemMonitors[i]);
+
+ if (programpath != NULL)
+ {
+ g_free(programpath);
+ /* we give up */
+ goto _system_monitor_found;
+ }
+
+ /* search another */
+ }
+
+ /* system monitor not found */
+ gtk_action_set_visible(gtk_action_group_get_action(action_group, "TasklistSystemMonitor"), FALSE);
+
+ _system_monitor_found:;
+ /* end of system monitor item */
+
+
ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-list-menu.xml", NULL);
mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(tasklist->applet), ui_path, action_group);
g_free(ui_path);
@@ -544,6 +588,31 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
return TRUE;
}
+static void callSystemMonitor(GtkAction* action, TasklistData* tasklist)
+{
+ char* argv[2] = {NULL, NULL};
+ char* programpath;
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS(listOfSystemMonitors); i += 1)
+ {
+ programpath = g_find_program_in_path(listOfSystemMonitors[i]);
+
+ if (programpath != NULL)
+ {
+ g_free(programpath);
+
+ argv[0] = listOfSystemMonitors[i];
+
+ gdk_spawn_on_screen(gtk_widget_get_screen(tasklist->applet), NULL, argv, NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, NULL);
+
+ return;
+ }
+ }
+}
+
static void display_help_dialog(GtkAction* action, TasklistData* tasklist)
{