gnomeradio r205 - in trunk: . src
- From: mfcn svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomeradio r205 - in trunk: . src
- Date: Sat, 13 Sep 2008 15:54:30 +0000 (UTC)
Author: mfcn
Date: Sat Sep 13 15:54:30 2008
New Revision: 205
URL: http://svn.gnome.org/viewvc/gnomeradio?rev=205&view=rev
Log:
* src/Makefile.am:
* src/eggtrayicon.c:
* src/eggtrayicon.h:
* src/gui.c (adj_value_changed_cb):
* src/trayicon.c (tray_activate_cb), (tray_popup_menu),
(create_tray_icon):
* src/trayicon.h:
Apply patch by Daniel Garcia to use GtkStatusIcon instead of egg-tray-icon (#417240)
Removed:
trunk/src/eggtrayicon.c
trunk/src/eggtrayicon.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gui.c
trunk/src/trayicon.c
trunk/src/trayicon.h
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sat Sep 13 15:54:30 2008
@@ -12,7 +12,6 @@
gnomeradio_SOURCES = \
bacon-volume.h \
- eggtrayicon.h \
gui.h \
prefs.h \
radio.h \
@@ -23,7 +22,6 @@
v4l1.h \
v4l2.h \
bacon-volume.c \
- eggtrayicon.c \
gui.c \
lirc.c \
prefs.c \
Modified: trunk/src/gui.c
==============================================================================
--- trunk/src/gui.c (original)
+++ trunk/src/gui.c Sat Sep 13 15:54:30 2008
@@ -24,7 +24,6 @@
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <math.h>
-#include "eggtrayicon.h"
#include "bacon-volume.h"
#include "gui.h"
#include "trayicon.h"
@@ -411,7 +410,7 @@
else
buffer = g_strdup_printf(_("Gnomeradio - %.2f MHz"), freq);
gtk_window_set_title(GTK_WINDOW(window), buffer);
- if (tray_icon) gtk_tooltips_set_tip(tooltips, tray_icon, buffer, NULL);
+ if (tray_icon) gtk_status_icon_set_tooltip(GTK_STATUS_ICON(tray_icon), buffer); //gtk_tooltips_set_tip(tooltips, tray_icon, buffer, NULL);
g_free(buffer);
buffer = g_strdup_printf(_("Frequency: %.2f MHz"), freq);
Modified: trunk/src/trayicon.c
==============================================================================
--- trunk/src/trayicon.c (original)
+++ trunk/src/trayicon.c Sat Sep 13 15:54:30 2008
@@ -110,58 +110,38 @@
gtk_widget_show_all(tray_menu);
}
-static gboolean tray_destroyed_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
+static void tray_activate_cb(GtkStatusIcon* icon, gpointer data)
{
- create_tray_icon(GTK_WIDGET(data));
- return TRUE;
+ gboolean active;
+ active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(showwindow_menuitem));
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(showwindow_menuitem), !active);
}
-static gboolean tray_clicked_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
+static void tray_popup_menu (GtkStatusIcon* icon, guint button, guint32 time, gpointer data)
{
- gboolean active;
- switch (event->button)
- {
- case 1:
- if (event->type != GDK_BUTTON_PRESS)
- break;
- active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(showwindow_menuitem));
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(showwindow_menuitem), !active);
- break;
- case 3:
- if (event->type != GDK_BUTTON_PRESS)
- break;
- gtk_menu_popup(GTK_MENU(tray_menu), NULL, NULL, NULL, NULL, event->button, event->time);
- break;
- }
- return FALSE;
+ gtk_menu_popup(GTK_MENU(tray_menu), NULL, NULL, NULL, icon, button, time);
}
void create_tray_icon(GtkWidget *app)
{
GdkPixbuf *pixbuf;
- GtkWidget *tray_icon_image;
GtkWidget *eventbox;
GtkIconTheme *icontheme;
char *text;
- tray_icon = GTK_WIDGET(egg_tray_icon_new (PACKAGE));
icontheme = gtk_icon_theme_get_default();
pixbuf = gtk_icon_theme_load_icon(icontheme, "gnomeradio", 22, 0, NULL);
g_return_if_fail(pixbuf);
- tray_icon_image = gtk_image_new_from_pixbuf(pixbuf);
+ tray_icon = G_OBJECT(gtk_status_icon_new_from_pixbuf(pixbuf));
gdk_pixbuf_unref(pixbuf);
- eventbox = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(eventbox), tray_icon_image);
- gtk_container_add (GTK_CONTAINER(tray_icon), eventbox);
- g_signal_connect(G_OBJECT(eventbox), "button-press-event",
- G_CALLBACK(tray_clicked_cb), (gpointer)app);
- g_signal_connect(G_OBJECT(tray_icon), "destroy-event",
- G_CALLBACK(tray_destroyed_cb), (gpointer)app);
- gtk_widget_show_all(GTK_WIDGET(tray_icon));
+ g_signal_connect(G_OBJECT(tray_icon), "activate",
+ G_CALLBACK(tray_activate_cb), (gpointer)app);
+ g_signal_connect(G_OBJECT(tray_icon), "popup-menu",
+ G_CALLBACK(tray_popup_menu), (gpointer)app);
text = g_strdup_printf(_("Gnomeradio - %.2f MHz"), adj->value/STEPS);
- gtk_tooltips_set_tip(tooltips, tray_icon, text, NULL);
+ gtk_status_icon_set_tooltip(GTK_STATUS_ICON(tray_icon), text);
g_free(text);
}
Modified: trunk/src/trayicon.h
==============================================================================
--- trunk/src/trayicon.h (original)
+++ trunk/src/trayicon.h Sat Sep 13 15:54:30 2008
@@ -18,7 +18,7 @@
#define _TRAYICON_H
GtkWidget *tray_menu;
-GtkWidget *tray_icon;
+GObject *tray_icon;
GtkWidget *mute_menuitem;
int mute_menuitem_toggled_cb_id;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]