~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/hooks.c

  • Committer: Michael Vogt
  • Date: 2011-10-05 10:09:25 UTC
  • mfrom: (639.1.6 app-indicator-port)
  • Revision ID: michael.vogt@ubuntu.com-20111005100925-c0j7d7k3706145uk
port to libappindicator (LP: #779382) to ensure its visible
under unity{,-2d}

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
   va_end(va);
42
42
}
43
43
 
44
 
void hooks_trayicon_update_tooltip (TrayApplet *un, int num_hooks)
45
 
{
46
 
   g_debug_hooks("update_tooltip: %p ", un);
47
 
   gchar *updates;
48
 
 
49
 
   updates = _("Information available");
50
 
 
51
 
   gtk_status_icon_set_tooltip_text(un->tray_icon, updates);
52
 
}
53
 
 
54
 
 
55
44
// compare a HookFile with a filename and find the HookFile that matches
56
45
gint compare_hook_func(gconstpointer a, gconstpointer b)
57
46
{
543
532
   TrayApplet *ta = (TrayApplet*)data;
544
533
   HookTrayAppletPrivate *priv = (HookTrayAppletPrivate*)ta->user_data;
545
534
 
546
 
   if(!gtk_status_icon_get_visible(ta->tray_icon))
 
535
   if(!tray_applet_ui_get_visible(ta))
547
536
      return FALSE;
548
537
 
549
538
   GtkWidget *d = GTK_WIDGET (gtk_builder_get_object(priv->gtk_builder,"dialog_hooks"));
683
672
   g_object_unref(settings);
684
673
 
685
674
   // no dialog, do the notification
686
 
   if((unseen_count > 0) && !gtk_status_icon_get_visible (ta->tray_icon))
 
675
   if((unseen_count > 0) && !tray_applet_ui_get_visible (ta))
687
676
      g_timeout_add(5000, show_notification, ta);
688
677
 
689
678
   switch(unseen_count) {
690
679
   case 0:
691
 
      gtk_status_icon_set_visible (ta->tray_icon, FALSE);
 
680
      tray_applet_ui_set_visible (ta, FALSE);
692
681
      gtk_widget_hide(button_next);
693
682
      break;
694
683
   case 1:
695
 
      gtk_status_icon_set_visible (ta->tray_icon, TRUE);
 
684
      tray_applet_ui_set_visible (ta, TRUE);
696
685
      gtk_widget_hide(button_next);
697
686
      break;
698
687
   default:
699
 
      gtk_status_icon_set_visible (ta->tray_icon, TRUE);
 
688
      tray_applet_ui_set_visible (ta, TRUE);
700
689
      gtk_widget_show(button_next);
701
690
      break;
702
691
   }
703
 
   hooks_trayicon_update_tooltip (ta, unseen_count);
704
692
 
705
693
   return TRUE;
706
694
}
882
870
   priv->gtk_builder = builder;
883
871
   gtk_builder_connect_signals (builder, (gpointer)ta);
884
872
 
885
 
   /* show dialog on click */
886
 
   g_signal_connect (G_OBJECT(ta->tray_icon),
887
 
                     "activate",
888
 
                     G_CALLBACK (button_release_cb),
889
 
                     ta);
 
873
   // create the applet
 
874
   tray_applet_ui_set_single_action(ta, 
 
875
                                  _("Information available"),
 
876
                                  G_CALLBACK (button_release_cb),
 
877
                                  ta);
890
878
 
891
879
   // create a bold tag
892
880
   GtkWidget *text = GTK_WIDGET (gtk_builder_get_object(builder, "textview_hook"));