static void switch_user_cb (GtkWidget *self, gpointer data) { MenuStart *ms = (MenuStart *) data; menu_start_hide (ms); xfce_exec (ms->switch_app, FALSE, FALSE, NULL); }
static void lock_screen_cb (GtkWidget *self, gpointer data) { MenuStart *ms = (MenuStart *) data; menu_start_hide (ms); xfce_exec (ms->lock_app, FALSE, FALSE, NULL); }
static gboolean mailwatch_button_release_cb(GtkWidget *w, GdkEventButton *evt, gpointer user_data) { XfceMailwatchPlugin *mwp = user_data; if(evt->x >= w->allocation.x && evt->x < w->allocation.x + w->allocation.width && evt->y >= w->allocation.y && evt->y < w->allocation.y + w->allocation.height) { switch(evt->button) { case 1: /* left */ if(mwp->click_command && *mwp->click_command) xfce_exec(mwp->click_command, FALSE, FALSE, NULL); break; case 2: /* middle */ xfce_mailwatch_force_update(mwp->mailwatch); break; } } if(evt->button == 2) gtk_button_released(GTK_BUTTON(w)); return FALSE; }
gboolean launcher_clicked (GtkWidget *event_box, GdkEventButton *event, t_launcher *launcher) { int size = 1.25 * launcher->quicklauncher->icon_size; if (event->button != 1) return FALSE; if (event->type == GDK_BUTTON_PRESS) { g_assert(launcher->zoomed_img); if(event->x < 0 || event->x > size || event->y < 0 || event->y > size) return FALSE; if (!launcher->clicked_img) { launcher->clicked_img = gdk_pixbuf_copy (launcher->zoomed_img); gdk_pixbuf_saturate_and_pixelate(launcher->zoomed_img, launcher->clicked_img, 5, TRUE); } gtk_image_set_from_pixbuf (GTK_IMAGE(launcher->image), launcher->clicked_img); } else if (event->type == GDK_BUTTON_RELEASE) { //g_assert(launcher->clicked_img); if (event->x > 0 && event->x < size && event->y > 0 && event->y < size) xfce_exec(launcher->command, FALSE, FALSE, NULL); gtk_image_set_from_pixbuf (GTK_IMAGE(launcher->image), launcher->def_img); gtk_container_set_border_width(GTK_CONTAINER (event_box), (int)launcher->quicklauncher->icon_size/8); //gtk_widget_set_size_request(launcher->image, size, size); } return TRUE; }
static void mailwatch_new_messages_changed_cb(XfceMailwatch *mailwatch, gpointer arg, gpointer user_data) { XfceMailwatchPlugin *mwp = user_data; guint new_messages = GPOINTER_TO_UINT( arg ); if(new_messages == 0 && mwp->newmail_icon_visible) { mailwatch_set_icon( mwp, FALSE ); gtk_tooltips_set_tip(mwp->tooltip, mwp->button, _("No new mail"), NULL); mwp->newmail_icon_visible = FALSE; mwp->new_messages = 0; } else if(new_messages > 0) { if(!mwp->newmail_icon_visible) { mailwatch_set_icon( mwp, TRUE ); mwp->newmail_icon_visible = TRUE; } if(new_messages != mwp->new_messages) { GString *ttip_str = g_string_sized_new(64); gchar **mailbox_names = NULL; guint *new_message_counts = NULL; gint i; g_string_append_printf(ttip_str, ngettext("You have %d new message:", "You have %d new messages:", new_messages), new_messages); mwp->new_messages = new_messages; xfce_mailwatch_get_new_message_breakdown(mwp->mailwatch, &mailbox_names, &new_message_counts); for(i = 0; mailbox_names[i]; i++) { if(new_message_counts[i] > 0) { g_string_append_c(ttip_str, '\n'); g_string_append_printf(ttip_str, Q_("tells how many new messages in each mailbox| %d in %s"), new_message_counts[i], mailbox_names[i]); } } g_strfreev(mailbox_names); g_free(new_message_counts); gtk_tooltips_set_tip(mwp->tooltip, mwp->button, ttip_str->str, NULL); g_string_free(ttip_str, TRUE); if(mwp->new_messages_command) xfce_exec(mwp->new_messages_command, FALSE, FALSE, NULL); } } }