Remove blinking from status icons

This feature was just a bad idea.
This commit is contained in:
Matthias Clasen 2010-09-02 09:37:06 -04:00
parent 46f15e7d68
commit 18b47b6cd0
4 changed files with 0 additions and 238 deletions

View File

@ -3068,8 +3068,6 @@ gtk_status_icon_get_title
gtk_status_icon_set_name
gtk_status_icon_set_visible
gtk_status_icon_get_visible
gtk_status_icon_set_blinking
gtk_status_icon_get_blinking
gtk_status_icon_is_embedded
gtk_status_icon_position_menu
gtk_status_icon_get_geometry

View File

@ -995,8 +995,6 @@ gtk_status_icon_set_has_tooltip
gtk_status_icon_get_has_tooltip
gtk_status_icon_set_visible
gtk_status_icon_get_visible
gtk_status_icon_set_blinking
gtk_status_icon_get_blinking
gtk_status_icon_is_embedded
gtk_status_icon_position_menu
gtk_status_icon_get_geometry

View File

@ -140,11 +140,6 @@ struct _GtkStatusIconPrivate
GIcon *gicon;
} image_data;
GdkPixbuf *blank_icon;
guint blinking_timeout;
guint blinking : 1;
guint blink_off : 1;
guint visible : 1;
};
@ -189,7 +184,6 @@ static gboolean gtk_status_icon_button_press (GtkStatusIcon *status_icon,
GdkEventButton *event);
static gboolean gtk_status_icon_button_release (GtkStatusIcon *status_icon,
GdkEventButton *event);
static void gtk_status_icon_disable_blinking (GtkStatusIcon *status_icon);
static void gtk_status_icon_reset_image_data (GtkStatusIcon *status_icon);
static void gtk_status_icon_update_image (GtkStatusIcon *status_icon);
@ -285,14 +279,6 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
GDK_TYPE_SCREEN,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_BLINKING,
g_param_spec_boolean ("blinking",
P_("Blinking"),
P_("Whether the status icon is blinking"),
FALSE,
GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_VISIBLE,
g_param_spec_boolean ("visible",
@ -972,14 +958,8 @@ gtk_status_icon_finalize (GObject *object)
GtkStatusIcon *status_icon = GTK_STATUS_ICON (object);
GtkStatusIconPrivate *priv = status_icon->priv;
gtk_status_icon_disable_blinking (status_icon);
gtk_status_icon_reset_image_data (status_icon);
if (priv->blank_icon)
g_object_unref (priv->blank_icon);
priv->blank_icon = NULL;
#ifdef GDK_WINDOWING_X11
g_signal_handlers_disconnect_by_func (priv->tray_icon,
gtk_status_icon_key_press, status_icon);
@ -1059,9 +1039,6 @@ gtk_status_icon_set_property (GObject *object,
case PROP_SCREEN:
gtk_status_icon_set_screen (status_icon, g_value_get_object (value));
break;
case PROP_BLINKING:
gtk_status_icon_set_blinking (status_icon, g_value_get_boolean (value));
break;
case PROP_VISIBLE:
gtk_status_icon_set_visible (status_icon, g_value_get_boolean (value));
break;
@ -1133,9 +1110,6 @@ gtk_status_icon_get_property (GObject *object,
case PROP_SCREEN:
g_value_set_object (value, gtk_status_icon_get_screen (status_icon));
break;
case PROP_BLINKING:
g_value_set_boolean (value, gtk_status_icon_get_blinking (status_icon));
break;
case PROP_VISIBLE:
g_value_set_boolean (value, gtk_status_icon_get_visible (status_icon));
break;
@ -1321,37 +1295,6 @@ emit_size_changed_signal (GtkStatusIcon *status_icon,
#endif
static GdkPixbuf *
gtk_status_icon_blank_icon (GtkStatusIcon *status_icon)
{
GtkStatusIconPrivate *priv = status_icon->priv;
if (priv->blank_icon)
{
gint width, height;
width = gdk_pixbuf_get_width (priv->blank_icon);
height = gdk_pixbuf_get_height (priv->blank_icon);
if (width == priv->image_width && height == priv->image_height)
return priv->blank_icon;
else
{
g_object_unref (priv->blank_icon);
priv->blank_icon = NULL;
}
}
priv->blank_icon = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
priv->image_width,
priv->image_height);
if (priv->blank_icon)
gdk_pixbuf_fill (priv->blank_icon, 0);
return priv->blank_icon;
}
#ifdef GDK_WINDOWING_X11
static GtkIconSize
@ -1400,30 +1343,6 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
HICON prev_hicon;
#endif
if (priv->blink_off)
{
#ifdef GDK_WINDOWING_X11
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image),
gtk_status_icon_blank_icon (status_icon));
#endif
#ifdef GDK_WINDOWING_WIN32
prev_hicon = priv->nid.hIcon;
priv->nid.hIcon = gdk_win32_pixbuf_to_hicon_libgtk_only (gtk_status_icon_blank_icon (status_icon));
priv->nid.uFlags |= NIF_ICON;
if (priv->nid.hWnd != NULL && priv->visible)
if (!Shell_NotifyIconW (NIM_MODIFY, &priv->nid))
g_warning (G_STRLOC ": Shell_NotifyIcon(NIM_MODIFY) failed");
if (prev_hicon)
DestroyIcon (prev_hicon);
#endif
#ifdef GDK_WINDOWING_QUARTZ
QUARTZ_POOL_ALLOC;
[priv->status_item setImage:gtk_status_icon_blank_icon (status_icon)];
QUARTZ_POOL_RELEASE;
#endif
return;
}
switch (priv->storage_type)
{
case GTK_IMAGE_PIXBUF:
@ -2293,49 +2212,6 @@ gtk_status_icon_get_screen (GtkStatusIcon *status_icon)
#endif
}
static gboolean
gtk_status_icon_blinker (GtkStatusIcon *status_icon)
{
GtkStatusIconPrivate *priv = status_icon->priv;
priv->blink_off = !priv->blink_off;
gtk_status_icon_update_image (status_icon);
return TRUE;
}
static void
gtk_status_icon_enable_blinking (GtkStatusIcon *status_icon)
{
GtkStatusIconPrivate *priv = status_icon->priv;
if (!priv->blinking_timeout)
{
gtk_status_icon_blinker (status_icon);
priv->blinking_timeout =
gdk_threads_add_timeout (BLINK_TIMEOUT,
(GSourceFunc) gtk_status_icon_blinker,
status_icon);
}
}
static void
gtk_status_icon_disable_blinking (GtkStatusIcon *status_icon)
{
GtkStatusIconPrivate *priv = status_icon->priv;
if (priv->blinking_timeout)
{
g_source_remove (priv->blinking_timeout);
priv->blinking_timeout = 0;
priv->blink_off = FALSE;
gtk_status_icon_update_image (status_icon);
}
}
/**
* gtk_status_icon_set_visible:
* @status_icon: a #GtkStatusIcon
@ -2409,62 +2285,6 @@ gtk_status_icon_get_visible (GtkStatusIcon *status_icon)
return status_icon->priv->visible;
}
/**
* gtk_status_icon_set_blinking:
* @status_icon: a #GtkStatusIcon
* @blinking: %TRUE to turn blinking on, %FALSE to turn it off
*
* Makes the status icon start or stop blinking.
* Note that blinking user interface elements may be problematic
* for some users, and thus may be turned off, in which case
* this setting has no effect.
*
* Since: 2.10
**/
void
gtk_status_icon_set_blinking (GtkStatusIcon *status_icon,
gboolean blinking)
{
GtkStatusIconPrivate *priv;
g_return_if_fail (GTK_IS_STATUS_ICON (status_icon));
priv = status_icon->priv;
blinking = blinking != FALSE;
if (priv->blinking != blinking)
{
priv->blinking = blinking;
if (blinking)
gtk_status_icon_enable_blinking (status_icon);
else
gtk_status_icon_disable_blinking (status_icon);
g_object_notify (G_OBJECT (status_icon), "blinking");
}
}
/**
* gtk_status_icon_get_blinking:
* @status_icon: a #GtkStatusIcon
*
* Returns whether the icon is blinking, see
* gtk_status_icon_set_blinking().
*
* Return value: %TRUE if the icon is blinking
*
* Since: 2.10
**/
gboolean
gtk_status_icon_get_blinking (GtkStatusIcon *status_icon)
{
g_return_val_if_fail (GTK_IS_STATUS_ICON (status_icon), FALSE);
return status_icon->priv->blinking;
}
/**
* gtk_status_icon_is_embedded:
* @status_icon: a #GtkStatusIcon

View File

@ -106,16 +106,6 @@ timeout_handler (gpointer data)
return TRUE;
}
static void
blink_toggle_toggled (GtkToggleButton *toggle)
{
GSList *l;
for (l = icons; l; l = l->next)
gtk_status_icon_set_blinking (GTK_STATUS_ICON (l->data),
gtk_toggle_button_get_active (toggle));
}
static void
visible_toggle_toggled (GtkToggleButton *toggle)
{
@ -177,15 +167,6 @@ icon_activated (GtkStatusIcon *icon)
g_signal_connect (toggle, "toggled",
G_CALLBACK (visible_toggle_toggled), NULL);
toggle = gtk_toggle_button_new_with_mnemonic ("_Blink the icon");
gtk_box_pack_end (GTK_BOX (content_area), toggle, TRUE, TRUE, 6);
gtk_widget_show (toggle);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
gtk_status_icon_get_blinking (icon));
g_signal_connect (toggle, "toggled",
G_CALLBACK (blink_toggle_toggled), NULL);
toggle = gtk_toggle_button_new_with_mnemonic ("_Change images");
gtk_box_pack_end (GTK_BOX (content_area), toggle, TRUE, TRUE, 6);
gtk_widget_show (toggle);
@ -199,35 +180,6 @@ icon_activated (GtkStatusIcon *icon)
gtk_window_present (GTK_WINDOW (dialog));
}
static void
check_activated (GtkCheckMenuItem *item)
{
GSList *l;
GdkScreen *screen;
screen = NULL;
for (l = icons; l; l = l->next)
{
GtkStatusIcon *icon = l->data;
GdkScreen *orig_screen;
orig_screen = gtk_status_icon_get_screen (icon);
if (screen != NULL)
gtk_status_icon_set_screen (icon, screen);
screen = orig_screen;
gtk_status_icon_set_blinking (icon,
gtk_check_menu_item_get_active (item));
}
g_assert (screen != NULL);
gtk_status_icon_set_screen (GTK_STATUS_ICON (icons->data), screen);
}
static void
do_properties (GtkMenuItem *item,
GtkStatusIcon *icon)
@ -279,11 +231,6 @@ popup_menu (GtkStatusIcon *icon,
gtk_menu_set_screen (GTK_MENU (menu),
gtk_status_icon_get_screen (icon));
menuitem = gtk_check_menu_item_new_with_label ("Blink");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
gtk_status_icon_get_blinking (icon));
g_signal_connect (menuitem, "activate", G_CALLBACK (check_activated), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
@ -340,7 +287,6 @@ main (int argc, char **argv)
g_signal_connect (icon, "notify::orientation", G_CALLBACK (orientation_changed_cb), NULL);
g_signal_connect (icon, "notify::screen", G_CALLBACK (screen_changed_cb), NULL);
g_print ("icon size %d\n", gtk_status_icon_get_size (icon));
gtk_status_icon_set_blinking (GTK_STATUS_ICON (icon), FALSE);
g_signal_connect (icon, "activate",
G_CALLBACK (icon_activated), NULL);