/pidgin/main: 825d41ada522: Use static inline functions instead ...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Wed Feb 12 21:47:26 EST 2014
Changeset: 825d41ada522a4aa19f22259d258ea6a93612e33
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-02-13 03:47 +0100
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/825d41ada522
Description:
Use static inline functions instead of macros
diffstat:
pidgin/gtk3compat.h | 63 +++++++++++++++++++++++++++++++---------------------
1 files changed, 38 insertions(+), 25 deletions(-)
diffs (73 lines):
diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -38,31 +38,44 @@
#define gtk_color_chooser_dialog_new(title, parent) \
gtk_color_selection_dialog_new(title)
-#define GTK_COLOR_CHOOSER(widget) (widget)
-#define gtk_color_chooser_set_use_alpha(widget, val) do { \
- if (GTK_IS_COLOR_BUTTON(widget)) \
- gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(widget), val); \
-} while (0)
-#define pidgin_color_chooser_set_rgb(widget, color) do { \
- if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) \
- gtk_color_selection_set_current_color( \
- GTK_COLOR_SELECTION( \
- gtk_color_selection_dialog_get_color_selection( \
- GTK_COLOR_SELECTION_DIALOG(widget))), \
- color); \
- else \
- gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), color); \
-} while (0)
-#define pidgin_color_chooser_get_rgb(widget, color) do { \
- if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) \
- gtk_color_selection_get_current_color( \
- GTK_COLOR_SELECTION( \
- gtk_color_selection_dialog_get_color_selection( \
- GTK_COLOR_SELECTION_DIALOG(widget))), \
- color); \
- else \
- gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), color); \
-} while (0)
+#define GTK_COLOR_CHOOSER(widget) (GTK_WIDGET(widget))
+
+static inline void
+gtk_color_chooser_set_use_alpha(GtkWidget *widget, gboolean use_alpha)
+{
+ if (GTK_IS_COLOR_BUTTON(widget)) {
+ gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(widget),
+ use_alpha);
+ }
+}
+
+static inline void
+pidgin_color_chooser_set_rgb(GtkWidget *widget, const GdkColor *color)
+{
+ if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
+ GtkWidget *colorsel;
+
+ colorsel = gtk_color_selection_dialog_get_color_selection(
+ GTK_COLOR_SELECTION_DIALOG(widget));
+ gtk_color_selection_set_current_color(
+ GTK_COLOR_SELECTION(colorsel), color);
+ } else
+ gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), color);
+}
+
+static inline void
+pidgin_color_chooser_get_rgb(GtkWidget *widget, GdkColor *color)
+{
+ if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
+ GtkWidget *colorsel;
+
+ colorsel = gtk_color_selection_dialog_get_color_selection(
+ GTK_COLOR_SELECTION_DIALOG(widget));
+ gtk_color_selection_get_current_color(
+ GTK_COLOR_SELECTION(colorsel), color);
+ } else
+ gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), color);
+}
#else
More information about the Commits
mailing list