]> Pileus Git - ~andy/gtk/commitdiff
Use G_SOURCE_CONTINUE/REMOVE
authorMatthias Clasen <mclasen@redhat.com>
Tue, 31 Jan 2012 00:12:27 +0000 (19:12 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 31 Jan 2012 00:12:27 +0000 (19:12 -0500)
Now that GLib provides these macros, we should use them
to make the code more readable.

27 files changed:
demos/gtk-demo/assistant.c
demos/gtk-demo/list_store.c
demos/gtk-demo/pixbufs.c
demos/gtk-demo/search_entry.c
demos/gtk-demo/textscroll.c
demos/gtk-demo/toolpalette.c
docs/reference/gtk/other_software.sgml
gdk/broadway/gdkdisplay-broadway.c
gdk/gdk.c
gdk/x11/gdkapplaunchcontext-x11.c
gtk/gtkapplication.c
gtk/gtkclipboard.c
gtk/gtkdnd-quartz.c
gtk/gtkprintoperation-unix.c
gtk/gtkstatusicon.c
gtk/tests/filechooser.c
modules/input/gtkimcontextmultipress.c
modules/printbackends/cups/gtkprintbackendcups.c
modules/printbackends/papi/gtkprintbackendpapi.c
modules/printbackends/test/gtkprintbackendtest.c
tests/a11y/testfocus.c
tests/reftests/gtk-reftest.c
tests/testgtk.c
tests/testimage.c
tests/testoffscreen.c
tests/testtreechanging.c
tests/testvolumebutton.c

index 5d7a4603574622dd0d25be57ab35156f7c442b47..7d7fbcd0542070bd2852ebad3e247f1726909432 100644 (file)
@@ -23,14 +23,14 @@ apply_changes_gradually (gpointer data)
   if (fraction < 1.0)
     {
       gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
-      return TRUE;
+      return G_SOURCE_CONTINUE;
     }
   else
     {
       /* Close automatically once changes are fully applied. */
       gtk_widget_destroy (assistant);
       assistant = NULL;
-      return FALSE;
+      return G_SOURCE_REMOVE;
     }
 }
 
index 40d113d7f65cfe189baf7b1840f33b0f4c56fde0..e5d2dff42b9427deff74850c71884d07f673135b 100644 (file)
@@ -60,7 +60,7 @@ spinner_timeout (gpointer data)
   guint pulse;
 
   if (model == NULL)
-    return FALSE;
+    return G_SOURCE_REMOVE;
 
   gtk_tree_model_get_iter_first (model, &iter);
   gtk_tree_model_get (model, &iter,
@@ -77,7 +77,7 @@ spinner_timeout (gpointer data)
                       COLUMN_ACTIVE, TRUE,
                       -1);
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static GtkTreeModel *
index ed1ed81b245a610d5611b2581b0be33d573754d4..9b29b5a7226a648a76b4f0088fbaf2cdd8b3fc78 100644 (file)
@@ -180,7 +180,7 @@ timeout (gpointer data)
   GDK_THREADS_LEAVE ();
 
   frame_num++;
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static guint timeout_id;
index 53d123418d823fc0e6a269dce46dc14bb5614f4b..03b728879c43772329733e99deeb5fc05653f4c7 100644 (file)
@@ -29,8 +29,7 @@ static gboolean
 search_progress (gpointer data)
 {
   gtk_entry_progress_pulse (GTK_ENTRY (data));
-
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
index a6cef0ead756fceb6e79b7890c2632fa281c193c..dae9b4334895c0bd6ce0eed5e2e6d4c12c2b8291 100644 (file)
@@ -49,7 +49,7 @@ scroll_to_end (GtkTextView *textview)
   if (count > 150)
     count = 0;
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 /* Scroll to the bottom of the buffer.
@@ -100,7 +100,7 @@ scroll_to_bottom (GtkTextView *textview)
   if (count > 40)
     count = 0;
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static guint
index 73ab5c1878b7f639d46b473ed23797b5644b0344..1a45fc14d46ff8a9684cd4778e48c8efe2c57d39 100644 (file)
@@ -350,7 +350,7 @@ interactive_canvas_real_drag_leave (gpointer data)
       gtk_widget_queue_draw (widget);
     }
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index 4b413a2b455a234997420a4ce41ba5c8b709a2a5..dde4295e6b34f71e48d979f4439c421b1e260b0e 100644 (file)
@@ -121,9 +121,9 @@ Here's a simple example:
     do_small_part_of_task ();
   
     if (task_complete)
-      return FALSE; /* removes the idle handler */
+      return G_SOURCE_REMOVE; /* removes the idle handler */
     else
-      return TRUE;  /* runs the idle handler again */
+      return G_SOURCE_CONTINUE;  /* runs the idle handler again */
   }
 
   g_idle_add (my_idle_handler, NULL);
index f2babc8f3967c3c92902f4ca414b48cf5792feeb..861560ef48fb80a3c53d5d3290cfd61e3f91e781 100644 (file)
@@ -483,7 +483,7 @@ process_input_idle_cb (GdkBroadwayDisplay *display)
 {
   display->process_input_idle = 0;
   process_input_messages (display);
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index d1793c922492a6240e23ac230165fa68659b725f..f34da89282247467fbe8e67daa74808b6ef75868 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -895,7 +895,7 @@ gdk_threads_add_idle (GSourceFunc    function,
  *    
  *    self->timeout_id = 0;
  *    
- *    return FALSE;
+ *    return G_SOURCE_REMOVE;
  * }
  *  
  * static void some_widget_do_stuff_later (SomeWidget *self)
index 825be753e4d886d217d272c5c3d56a935655ec05..9fa33044af80fc0e32ab295a9941fa19e1ff9651 100644 (file)
@@ -221,7 +221,7 @@ startup_timeout (void *data)
     std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
 
   /* always remove this one, but we may have reinstalled another one. */
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 
index ac54e1e016ecaae556d5b6a6a8a29a1babf73d42..d5bdd730377b66a037624e36125d3103478333d5 100644 (file)
@@ -1598,7 +1598,7 @@ idle_will_quit (gpointer data)
       gtk_widget_destroy (dialog);
     }
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static pascal OSErr
index 7b223ff4ed357f4bfe2bebe88f86601e8caa8990..5f5a471540a01246a30c01579b4ac873555cb47d 100644 (file)
@@ -2017,7 +2017,7 @@ gtk_clipboard_store_timeout (GtkClipboard *clipboard)
 {
   g_main_loop_quit (clipboard->store_loop);
   
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 /**
index 6b3d123b18e2cdbcca5888344fac3c3b2c52bec9..a1754ae77d089ec2a09b32aeab03d9a59b04183c 100644 (file)
@@ -1072,7 +1072,7 @@ gtk_drag_begin_idle (gpointer arg)
   [types release];
 
   if ((nswindow = get_toplevel_nswindow (info->source_widget)) == NULL)
-     return FALSE;
+     return G_SOURCE_REMOVE;
   
   /* Ref the context. It's unreffed when the drag has been aborted */
   g_object_ref (info->context);
@@ -1084,7 +1084,7 @@ gtk_drag_begin_idle (gpointer arg)
   if (drag_image == NULL)
     {
       g_object_unref (info->context);
-      return FALSE;
+      return G_SOURCE_REMOVE;
     }
 
   point.x -= info->hot_x;
@@ -1103,7 +1103,7 @@ gtk_drag_begin_idle (gpointer arg)
 
   [pool release];
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 /* Fake protocol to let us call GdkNSView gdkWindow without including
  * gdk/GdkNSView.h (which we can't because it pulls in the internal-only
@@ -1858,7 +1858,7 @@ static gboolean
 drag_drop_finished_idle_cb (gpointer data)
 {
   gtk_drag_source_info_destroy (data);
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index e220e590b90d79567645ec3bf00fad7d8ee8666d..4fae6d7633d59e6079b7d990e9642f52ddb3bbd1 100644 (file)
@@ -1068,7 +1068,7 @@ find_printer_idle (gpointer data)
   
   printer_finder_free (finder);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index 1dffba88279cf25be041f3c0b694737cc9d6f1ff..6f7bf89824a7b48ab73f89ab1891ca91f0aee80c 100644 (file)
@@ -682,7 +682,7 @@ button_callback (gpointer data)
   gdk_event_free ((GdkEvent *) bc->event);
   g_free (data);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static UINT taskbar_created_msg = 0;
index 3d82eefd6636da44fcf091749c5d785e8317b429..69cac2139829aad7d00d2c7f4592912a387b8545 100644 (file)
@@ -86,7 +86,7 @@ wait_for_idle_idle (gpointer data)
 {
   wait_for_idle_id = 0;
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index 23578e0f3c7d127d189fbefc6b100bd0c3d925ec..2f2b7b122ce8601880bd73aff167b30e0e73fe91 100644 (file)
@@ -211,7 +211,7 @@ on_timeout (gpointer data)
 
   GDK_THREADS_LEAVE ();
 
-  return FALSE; /* don't call me again */
+  return G_SOURCE_REMOVE; /* don't call me again */
 }
 
 static gboolean
index d52cb4d744bc9392f21a24677e78a820fc0feab7..c338ae577df1148465d8eed8337e8560691d99ff 100644 (file)
@@ -843,7 +843,7 @@ request_password (gpointer data)
   gint                       i;
 
   if (dispatch->backend->authentication_lock)
-    return FALSE;
+    return G_SOURCE_REMOVE;
 
   httpGetHostname (dispatch->request->http, hostname, sizeof (hostname));
   if (is_address_local (hostname))
@@ -956,7 +956,7 @@ request_password (gpointer data)
   g_free (auth_info_visible);
   g_free (key);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
@@ -1040,10 +1040,10 @@ check_auth_info (gpointer user_data)
           dispatch->request->auth_info = NULL;
         }
 
-      return FALSE;
+      return G_SOURCE_REMOVE;
     }
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static gboolean
@@ -1612,7 +1612,7 @@ cups_job_info_poll_timeout (gpointer user_data)
   else
     cups_request_job_info (data);
   
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index c10b207d91d446464bb165b7ab72a8e355416d41..4ce3fb6b74b3afebfd7b59bfc852265303f0a45b 100644 (file)
@@ -802,7 +802,7 @@ papi_display_printer_status (gpointer user_data)
   papi_printer = GTK_PRINTER_PAPI (printer);
   if (papiServiceCreate (&service, NULL, NULL, NULL, NULL, PAPI_ENCRYPT_NEVER,
                           NULL) != PAPI_OK)
-    return FALSE;
+    return G_SOURCE_REMOVE;
 
   if (papiPrinterQuery (service, papi_printer->printer_name, NULL, NULL,
                         &current_printer) != PAPI_OK) 
@@ -845,7 +845,7 @@ papi_display_printer_status (gpointer user_data)
   papiServiceDestroy (service);
   gtk_printer_set_has_details (printer, TRUE);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void  
index 14c8e52db4cb7eba6f76f7f897189b8060d9c21b..b10432bc9200197d523380bb82595200ac11047f 100644 (file)
@@ -549,7 +549,7 @@ test_printer_prepare_for_print (GtkPrinter       *printer,
 }
 
 static gboolean
-test_printer_details_aquired_cb (GtkPrinter *printer)
+test_printer_details_acquired_cb (GtkPrinter *printer)
 {
   gboolean success;
   gint weight;
@@ -565,7 +565,7 @@ test_printer_details_aquired_cb (GtkPrinter *printer)
   gtk_printer_set_has_details (printer, success);
   g_signal_emit_by_name (printer, "details-acquired", success);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
@@ -590,7 +590,7 @@ test_printer_request_details (GtkPrinter *printer)
   else
     time *= 1000;
 
-  g_timeout_add (time, (GSourceFunc) test_printer_details_aquired_cb, printer);
+  g_timeout_add (time, (GSourceFunc) test_printer_details_acquired_cb, printer);
 }
 
 
index 131a82ae60bc59a602a9857e803764de4852ddaa..c438f6d5c203e2cebadeddf9c7c4c0f4594dc58f 100644 (file)
@@ -50,7 +50,7 @@ compare_focus (gpointer data)
     g_print ("gtk focus: %s != atk focus: %s\n",
              get_name (gtk_focus), get_name (atk_focus));
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
index 5b002f1a503f06f4dc88c6fc33bf1f90b5da5cac..ae41d32010321512f4c2ab44e89006e6566051af 100644 (file)
@@ -198,7 +198,7 @@ quit_when_idle (gpointer loop)
 {
   g_main_loop_quit (loop);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 static void
index 203ecb45554b9697859c0eda91b03697c03b2cf3..655868b561a6a9cf17a2f6e1e05791a810706834 100644 (file)
@@ -3656,7 +3656,7 @@ entry_progress_timeout (gpointer data)
       gtk_entry_set_progress_fraction (GTK_ENTRY (data), fraction);
     }
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
@@ -9047,7 +9047,7 @@ idle_test (GtkWidget *label)
   sprintf (buffer, "count: %d", ++count);
   gtk_label_set_text (GTK_LABEL (label), buffer);
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
index 2f0da45bb9423b3e980e70a4995e73e84186897e..73072edebc7481087e04905f70ba5817179c4cc0 100644 (file)
@@ -74,7 +74,7 @@ idle_func (gpointer data)
 {
   g_print ("keep me busy\n");
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static gboolean
index ff9ba6b9e07525cd50f375fb29af8e2af62d435b..62589b5dd8b0d74fc2cf1d092d1ef78eba2ab924 100644 (file)
@@ -63,9 +63,8 @@ scroll_layout (gpointer data)
   GtkAdjustment *adj;
 
   adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (layout));
-  gtk_adjustment_set_value (adj,
-                           gtk_adjustment_get_value (adj) + 5.0);
-  return TRUE;
+  gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) + 5.0);
+  return G_SOURCE_CONTINUE;
 }
 
 static guint layout_timeout;
index 106fc3704a27ee3cdde8eadeb62987e582c7599a..478e5fcb6896fd0e0891685415c6c3efec659327 100644 (file)
@@ -407,7 +407,7 @@ dance (gpointer treeview)
 
   check_sanity (treeview);
 
-  return TRUE;
+  return G_SOURCE_CONTINUE;
 }
 
 static void
index 29b3e33f94f6383490995cacbe933732f6aceb49..85e7469bc542a49fc798852ff614c846d26546b0 100644 (file)
@@ -70,7 +70,7 @@ show_error (gpointer data)
                     G_CALLBACK (response_cb), NULL);
   gtk_widget_show (dialog);
 
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 int