Permalink
Browse files

sticky display.

  • Loading branch information...
1 parent 3bc01a7 commit cab80f2ec63b9e30f897483685d04b874deb013b @mattn committed Aug 2, 2012
Showing with 16 additions and 5 deletions.
  1. +3 −2 display/balloon/balloon.c
  2. +2 −2 display/fog/fog.c
  3. +10 −1 gol.c
  4. +1 −0 gol.h
View
5 display/balloon/balloon.c
@@ -56,7 +56,6 @@ typedef struct {
gint default_timeout;
gint timeout;
gint offset;
- gboolean sticky;
gboolean hover;
struct {
GtkWidget* popup;
@@ -92,6 +91,7 @@ display_clicked(GtkWidget* GOL_UNUSED_ARG(widget), GdkEvent* GOL_UNUSED_ARG(even
DISPLAY_INFO* const di = (DISPLAY_INFO*) user_data;
if (di->timeout >= 30) di->timeout = 30;
if (di->ni->url && *di->ni->url) open_url(di->ni->url);
+ di->ni->sticky = FALSE;
}
static void
@@ -112,7 +112,8 @@ display_animation_func(gpointer data) {
DISPLAY_INFO* const di = (DISPLAY_INFO*) data;
if (di->hover) return TRUE; // Do nothing.
- --di->timeout;
+ if (di->timeout >= 50 || !di->ni->sticky)
+ --di->timeout;
if (di->timeout < 0) {
notifications = g_list_remove(notifications, di);
View
4 display/fog/fog.c
@@ -52,7 +52,6 @@ typedef struct {
gint default_timeout;
gint timeout;
gint offset;
- gboolean sticky;
gboolean hover;
struct {
GtkWidget* popup;
@@ -89,6 +88,7 @@ display_clicked(GtkWidget* GOL_UNUSED_ARG(widget), GdkEvent* GOL_UNUSED_ARG(even
DISPLAY_INFO* const di = (DISPLAY_INFO*) user_data;
if (di->timeout >= 30) di->timeout = 30;
if (di->ni->url && *di->ni->url) open_url(di->ni->url);
+ di->ni->sticky = FALSE;
}
static void
@@ -109,7 +109,7 @@ display_animation_func(gpointer data) {
DISPLAY_INFO* const di = (DISPLAY_INFO*) data;
if (di->hover) return TRUE; // Do nothing.
- if (di->timeout >= 30 || !di->sticky)
+ if (di->timeout >= 30 || !di->ni->sticky)
--di->timeout;
if (di->timeout < 0) {
View
11 gol.c
@@ -896,13 +896,15 @@ settings_clicked(GtkWidget* GOL_UNUSED_ARG(widget), GdkEvent* GOL_UNUSED_ARG(eve
hbox = gtk_hbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0);
+ /*
GtkWidget* entry = gtk_entry_new();
g_signal_connect(G_OBJECT(entry), "focus-out-event",
G_CALLBACK(parameter_focus_out), NULL);
g_object_set_data(G_OBJECT(setting_dialog), "parameter", entry);
gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
label = gtk_label_new("Parameter:");
gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ */
void
append_display_plugins(DISPLAY_PLUGIN* dp) {
@@ -1463,6 +1465,7 @@ gntp_recv_proc(gpointer user_data) {
char* notification_name = NULL;
char* notification_icon = NULL;
gboolean notification_enabled = FALSE;
+ gboolean notification_sticky = FALSE;
char* notification_display_name = NULL;
while (*ptr) {
char* const line = ptr;
@@ -1485,6 +1488,9 @@ gntp_recv_proc(gpointer user_data) {
else if (!strncmp(line, "Notification-Display-Name:", 26)) {
str_swap(&value, &notification_display_name);
}
+ else if (!strncmp(line, "Notification-Sticky:", 20)) {
+ notification_sticky = strcasecmp(value, "true") == 0;
+ }
g_free(value);
}
}
@@ -1516,7 +1522,7 @@ gntp_recv_proc(gpointer user_data) {
notification_enabled,
notification_display_name ?
notification_display_name : "Fog",
- FALSE);
+ notification_sticky);
}
g_free(notification_name);
@@ -1564,6 +1570,9 @@ gntp_recv_proc(gpointer user_data) {
else if (!strncmp(line, "Notification-Icon:", 18)) {
str_swap(&value, &ni->icon);
}
+ else if (!strncmp(line, "Notification-Sticky:", 20)) {
+ ni->sticky = strcasecmp(value, "true") == 0;
+ }
else if (!strncmp(line, "Notification-Callback-Target:", 29)) {
str_swap(&value, &ni->url);
}
View
1 gol.h
@@ -41,6 +41,7 @@ typedef struct {
gchar* text;
gchar* icon;
gchar* url;
+ gboolean sticky;
gboolean local;
gint timeout;
} NOTIFICATION_INFO;

0 comments on commit cab80f2

Please sign in to comment.