chiark / gitweb /
Fix edit menu (and simplify its implementation a bit).
[disorder] / disobedience / disobedience.c
index e8bbc400bbe5cf7a9c991dc05f621aff6d56e6db..5acadf894e10d22f287039f9f274dfbdb757fdb0 100644 (file)
@@ -96,6 +96,8 @@ int rtp_supported;
 /** @brief True if RTP play is enabled */
 int rtp_is_running;
 
+static void check_rtp_address(void);
+
 /* Window creation --------------------------------------------------------- */
 
 /* Note that all the client operations kicked off from here will only complete
@@ -116,11 +118,16 @@ static gboolean delete_event(GtkWidget attribute((unused)) *widget,
  *
  * Updates the menu settings to correspond to the new page.
  */
-static void tab_switched(GtkNotebook attribute((unused)) *notebook,
+static void tab_switched(GtkNotebook *notebook,
                          GtkNotebookPage attribute((unused)) *page,
                          guint page_num,
                          gpointer attribute((unused)) user_data) {
   menu_update(page_num);
+  GtkWidget *const tab = gtk_notebook_get_nth_page(notebook, page_num);
+  const struct tabtype *const t = g_object_get_data(G_OBJECT(tab), "type");
+  assert(t != 0);
+  if(t->selected)
+    t->selected();
 }
 
 /** @brief Create the report box */
@@ -321,6 +328,8 @@ static gboolean periodic_slow(gpointer attribute((unused)) data) {
                               config->username, "rights",
                               0);
   }
+  /* Recheck RTP status too */
+  check_rtp_address();
   return TRUE;                          /* don't remove me */
 }
 
@@ -445,7 +454,6 @@ void logged_in(void) {
   rtp_supported = 0;
   event_raise("logged-in", 0);
   /* Force the periodic checks */
-  check_rtp_address();
   periodic_slow(0);
   periodic_fast(0);
 }
@@ -505,7 +513,6 @@ int main(int argc, char **argv) {
   /* Start monitoring the log */
   disorder_eclient_log(logclient, &log_callbacks, 0);
   /* Initiate all the checks */
-  check_rtp_address();
   periodic_slow(0);
   periodic_fast(0);
   suppress_actions = 0;