aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-05 21:37:36 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-06 08:19:09 -0300
commit74267daf2105f6eb22b63f5afea4001df20211c0 (patch)
treeadf7c5e9e60fc96585ff03ec0bf8530d8cc31470 /src
parent8f1c0e19e683ab937a66bda86307cd5d9d265f18 (diff)
Remove the tray icon
There is a somewhat complex logic here that just adds a camorama icon to the tray bar. The only action it provides is that a click makes the window to minimize. That's too much effort for too little gain. As the API it uses is deprecated on gtk 3 in favor of Gnotification, it sounds better to just get rid of it for good. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in6
-rw-r--r--src/callbacks.c28
-rw-r--r--src/callbacks.h1
-rw-r--r--src/camorama-stock-items.c52
-rw-r--r--src/camorama-stock-items.h13
-rw-r--r--src/camorama-window.c49
-rw-r--r--src/main.c12
-rw-r--r--src/v4l.h3
9 files changed, 6 insertions, 160 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 71d08bd..9691eac 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,8 +18,6 @@ camorama_SOURCES = \
camorama-filter-mirror.c \
camorama-filter-reichardt.c \
camorama-globals.h \
- camorama-stock-items.c \
- camorama-stock-items.h \
camorama-window.c \
camorama-window.h \
filter.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index d574653..3f1c8b1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -106,8 +106,7 @@ am_camorama_OBJECTS = callbacks.$(OBJEXT) \
camorama-filter-chain.$(OBJEXT) \
camorama-filter-laplace.$(OBJEXT) \
camorama-filter-mirror.$(OBJEXT) \
- camorama-filter-reichardt.$(OBJEXT) \
- camorama-stock-items.$(OBJEXT) camorama-window.$(OBJEXT) \
+ camorama-filter-reichardt.$(OBJEXT) camorama-window.$(OBJEXT) \
filter.$(OBJEXT) main.$(OBJEXT) support.$(OBJEXT) \
v4l.$(OBJEXT) fileio.$(OBJEXT) $(am__objects_1)
camorama_OBJECTS = $(am_camorama_OBJECTS)
@@ -311,8 +310,6 @@ camorama_SOURCES = \
camorama-filter-mirror.c \
camorama-filter-reichardt.c \
camorama-globals.h \
- camorama-stock-items.c \
- camorama-stock-items.h \
camorama-window.c \
camorama-window.h \
filter.c \
@@ -424,7 +421,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-laplace.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-mirror.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-filter-reichardt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-stock-items.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/camorama-window.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@
diff --git a/src/callbacks.c b/src/callbacks.c
index 3d2ec9f..0adac6b 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -118,7 +118,6 @@ void cap_func(GtkWidget *rb, cam_t *cam)
cam->cap = gtk_toggle_button_get_active((GtkToggleButton *) rb);
gconf_client_set_bool(cam->gc, KEY12, cam->cap, NULL);
- update_tooltip(cam);
set_sensitive(cam);
}
@@ -127,7 +126,6 @@ void rcap_func(GtkWidget *rb, cam_t *cam)
cam->rcap = gtk_toggle_button_get_active((GtkToggleButton *) rb);
gconf_client_set_bool(cam->gc, KEY13, cam->rcap, NULL);
- update_tooltip(cam);
set_sensitive(cam);
}
@@ -152,7 +150,6 @@ void acap_func(GtkWidget *rb, cam_t *cam)
}
g_source_remove(cam->timeout_id);
}
- update_tooltip(cam);
set_sensitive(cam);
}
@@ -173,7 +170,6 @@ void interval_change(GtkWidget *sb, cam_t *cam)
cam->timeout_id, cam->timeout_interval);
}
}
- update_tooltip(cam);
}
void rjpg_func(GtkWidget *rb, cam_t *cam)
@@ -804,27 +800,3 @@ void wb_change(GtkHScale *sc1, cam_t *cam)
cam->whiteness = 256 * (int)gtk_range_get_value((GtkRange *) sc1);
v4l2_set_control(cam->dev, V4L2_CID_WHITENESS, cam->whiteness);
}
-
-void update_tooltip(cam_t *cam)
-{
- gchar *tooltip_text;
-
- if (cam->debug == TRUE)
- printf("update_tooltip called\n");
-
- if (cam->acap == TRUE) {
- tooltip_text = g_strdup_printf(_("Local Capture: %d\n"
- "Remote Capture: %d\n"
- "Capture Interval: %d"),
- cam->cap, cam->rcap,
- cam->timeout_interval / 60000);
- if (cam->debug == TRUE)
- printf("tip - acap on\n");
- } else {
- if (cam->debug == TRUE)
- printf("tip - acap off\n");
- tooltip_text = g_strdup_printf(_("Automatic Capture Disabled"));
- }
- gtk_status_icon_set_tooltip_text(cam->tray_icon, tooltip_text);
- g_free(tooltip_text);
-}
diff --git a/src/callbacks.h b/src/callbacks.h
index 3b6007c..f52e498 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -68,7 +68,6 @@ void hue_change(GtkHScale *, cam_t *);
void wb_change(GtkHScale *, cam_t *);
gboolean on_drawingarea_expose_event(GtkWidget *, GdkEventExpose *,
cam_t *);
-void update_tooltip(cam_t *cam);
void set_image_scale(cam_t *cam);
G_END_DECLS
diff --git a/src/camorama-stock-items.c b/src/camorama-stock-items.c
deleted file mode 100644
index b88674c..0000000
--- a/src/camorama-stock-items.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "camorama-stock-items.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib/gi18n.h>
-#include "v4l.h"
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
-static GtkStockItem camorama_items[] = {
- {CAMORAMA_STOCK_WEBCAM, N_("Webcam"), 0, 0, "camorama"}
-};
-
-#pragma GCC diagnostic pop
-
-static void add_default_image(const gchar * stock_id, gint size,
- const gchar * pixfilename)
-{
- GdkPixbuf *buf = gdk_pixbuf_new_from_file(pixfilename, NULL);
-
- g_return_if_fail(buf);
-
- gtk_icon_theme_add_builtin_icon(stock_id, size, buf);
- g_object_unref(buf);
-}
-
-void camorama_stock_init(void)
-{
- GtkIconFactory *factory = gtk_icon_factory_new();
- GtkIconSet *set = gtk_icon_set_new();
- GtkIconSource *source = gtk_icon_source_new();
-
- gtk_stock_add_static(camorama_items, G_N_ELEMENTS(camorama_items));
-
- gtk_icon_source_set_size_wildcarded(source, TRUE);
- gtk_icon_source_set_direction_wildcarded(source, TRUE);
- gtk_icon_source_set_state_wildcarded(source, TRUE);
-
- gtk_icon_source_set_icon_name(source, CAMORAMA_STOCK_WEBCAM);
- gtk_icon_set_add_source(set, source);
-
- gtk_icon_factory_add(factory, CAMORAMA_STOCK_WEBCAM, set);
-
- add_default_image(CAMORAMA_STOCK_WEBCAM, 24, PACKAGE_DATA_DIR
- "/icons/hicolor/24x24/devices/camorama.png");
- gtk_icon_factory_add_default(factory);
-
- gtk_icon_set_unref(set);
- gtk_icon_source_free(source);
-}
diff --git a/src/camorama-stock-items.h b/src/camorama-stock-items.h
deleted file mode 100644
index 1fa1ba5..0000000
--- a/src/camorama-stock-items.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef CAMORAMA_STOCK_ITEMS_H
-#define CAMORAMA_STOCK_ITEMS_H
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-void camorama_stock_init(void);
-
-#define CAMORAMA_STOCK_WEBCAM "camorama-webcam"
-
-G_END_DECLS
-#endif /* !CAMORAMA_STOCK_ITEMS_H */
diff --git a/src/camorama-window.c b/src/camorama-window.c
index 70da11a..f5b1c76 100644
--- a/src/camorama-window.c
+++ b/src/camorama-window.c
@@ -32,7 +32,6 @@
#include "callbacks.h"
#include "camorama-filter-chain.h"
#include "camorama-globals.h"
-#include "camorama-stock-items.h"
#include "filter.h"
#include "glib-helpers.h"
#include "support.h"
@@ -168,34 +167,6 @@ static gboolean treeview_clicked_cb(cam_t *cam, GdkEventButton *ev,
return retval;
}
-static gboolean tray_clicked_callback(GtkStatusIcon *icon, GdkEventButton *ev,
- cam_t *cam)
-{
- switch (ev->button) {
- case 1:
- if (gtk_widget_get_visible(GTK_WIDGET(gtk_builder_get_object(cam->xml, "main_window")))) {
- cam->hidden = TRUE;
- g_source_remove(cam->idle_id);
- gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object
- (cam->xml, "main_window")));
- } else {
- cam->idle_id = g_idle_add((GSourceFunc) pt2Function,
- (gpointer) cam);
- gtk_widget_show(GTK_WIDGET(gtk_builder_get_object
- (cam->xml, "main_window")));
- cam->hidden = FALSE;
- }
- break;
- case 3:
- //gw = MyApp->GetMainWindow ();
- //gnomemeeting_component_view (NULL, (gpointer) gw->ldap_window);
- break;
- default:
- break;
- }
- return FALSE;
-}
-
void load_interface(cam_t *cam)
{
unsigned int i;
@@ -227,11 +198,6 @@ void load_interface(cam_t *cam)
g_signal_connect_swapped(treeview, "popup-menu",
G_CALLBACK(treeview_popup_menu_cb), cam);
- logo = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gtk_widget_get_screen(window)),
- CAMORAMA_STOCK_WEBCAM, 24, 0, NULL);
- gtk_window_set_default_icon(logo);
- logo = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gtk_widget_get_screen(window)),
- "camorama", 48, 0, NULL);
if (cam->show_adjustments == FALSE) {
gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(cam->xml,
"adjustments_table")));
@@ -247,21 +213,14 @@ void load_interface(cam_t *cam)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_builder_get_object(cam->xml, "show_effects")),
cam->show_effects);
- cam->tray_icon = gtk_status_icon_new_from_stock(CAMORAMA_STOCK_WEBCAM);
- update_tooltip(cam);
- /* add the status to the plug */
- g_object_set_data(G_OBJECT(cam->tray_icon), "available",
- GINT_TO_POINTER(1));
- g_object_set_data(G_OBJECT(cam->tray_icon), "embedded",
- GINT_TO_POINTER(0));
-
- g_signal_connect(cam->tray_icon, "button-press-event",
- G_CALLBACK(tray_clicked_callback), cam);
-
/* connect the signals in the interface
* glade_xml_signal_autoconnect(xml);
* this won't work, can't pass data to callbacks. have to do it individually :(*/
+ logo = gdk_pixbuf_new_from_file(PACKAGE_DATA_DIR
+ "/icons/hicolor/128x128/devices/camorama.png",
+ NULL);
+ gtk_window_set_default_icon(logo);
gtk_window_set_icon(GTK_WINDOW(window), logo);
gtk_window_set_icon(GTK_WINDOW(GTK_WIDGET(gtk_builder_get_object(cam->xml, "prefswindow"))), logo);
diff --git a/src/main.c b/src/main.c
index 1420c01..1ceb0a4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -12,8 +12,6 @@
#include <locale.h>
#include <libv4l2.h>
-#include "camorama-stock-items.h"
-
static int ver = 0, max = 0, min;
static int half = 0, use_read = 0, buggery = 0;
static gchar *poopoo = NULL;
@@ -78,7 +76,6 @@ int main(int argc, char *argv[])
}
/* gtk is initialized now */
- camorama_stock_init();
camorama_filters_init();
cam->debug = buggery;
@@ -209,15 +206,6 @@ int main(int argc, char *argv[])
exit(1);
}
- /*eggtray */
-
- /*tray_icon = egg_tray_icon_new ("Our other cool tray icon");
- * button = gtk_button_new_with_label ("This is a another\ncool tray icon");
- * g_signal_connect (button, "clicked",
- * G_CALLBACK (second_button_pressed), tray_icon);
- *
- * gtk_container_add (GTK_CONTAINER (tray_icon), button);
- * gtk_widget_show_all (GTK_WIDGET (tray_icon)); */
load_interface(cam);
widget = GTK_WIDGET(gtk_builder_get_object(cam->xml, "da"));
diff --git a/src/v4l.h b/src/v4l.h
index bc81061..f4e7c43 100644
--- a/src/v4l.h
+++ b/src/v4l.h
@@ -75,14 +75,13 @@ typedef struct camera {
gboolean cap, rcap, acap, show_adjustments, show_effects;
gboolean timestamp, rtimestamp, usedate, usestring;
gboolean rtimefn, timefn;
- GtkWidget *da, *tray_tooltip, *status;
+ GtkWidget *da, *status;
unsigned char *pic_buf, *tmp;
guint timeout_id, idle_id;
guint32 timeout_interval;
GConfClient *gc;
GtkBuilder *xml;
GdkPixbuf *pb;
- GtkStatusIcon *tray_icon;
CamoramaFilterChain *filter_chain;

Privacy Policy