[libdazzle] menu-button: use dzl_str_empty0()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] menu-button: use dzl_str_empty0()
- Date: Sun, 9 Jul 2017 22:18:28 +0000 (UTC)
commit b7669f0fdfdbdc79e50e3b906c57ebff5346255a
Author: Christian Hergert <chergert redhat com>
Date: Sun Jul 9 15:17:53 2017 -0700
menu-button: use dzl_str_empty0()
src/menus/dzl-menu-button-section.c | 4 +++-
src/menus/dzl-menu-manager.c | 9 ++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/menus/dzl-menu-button-section.c b/src/menus/dzl-menu-button-section.c
index e175384..80c370b 100644
--- a/src/menus/dzl-menu-button-section.c
+++ b/src/menus/dzl-menu-button-section.c
@@ -22,6 +22,7 @@
#include "menus/dzl-menu-button-section.h"
#include "menus/dzl-menu-button-item.h"
#include "widgets/dzl-box.h"
+#include "util/dzl-util-private.h"
struct _DzlMenuButtonSection
{
@@ -170,7 +171,8 @@ dzl_menu_button_section_set_property (GObject *object,
case PROP_LABEL:
gtk_label_set_label (self->label, g_value_get_string (value));
- gtk_widget_set_visible (GTK_WIDGET (self->label), !!g_value_get_string (value));
+ gtk_widget_set_visible (GTK_WIDGET (self->label),
+ !dzl_str_empty0 (g_value_get_string (value)));
break;
default:
diff --git a/src/menus/dzl-menu-manager.c b/src/menus/dzl-menu-manager.c
index 590eb95..f4a955b 100644
--- a/src/menus/dzl-menu-manager.c
+++ b/src/menus/dzl-menu-manager.c
@@ -20,7 +20,8 @@
#include <string.h>
-#include "dzl-menu-manager.h"
+#include "menus/dzl-menu-manager.h"
+#include "util/dzl-util-private.h"
struct _DzlMenuManager
{
@@ -32,8 +33,6 @@ struct _DzlMenuManager
G_DEFINE_TYPE (DzlMenuManager, dzl_menu_manager, G_TYPE_OBJECT)
-#define str_equal0(a,b) (g_strcmp0(a,b) == 0)
-
#define DZL_MENU_ATTRIBUTE_BEFORE "before"
#define DZL_MENU_ATTRIBUTE_AFTER "after"
#define DZL_MENU_ATTRIBUTE_MERGE_ID "dazzle-merge-id"
@@ -244,7 +243,7 @@ dzl_menu_manager_resolve_constraints (GMenu *menu)
g_menu_model_get_item_attribute (model, j, "id", "s", &j_id);
g_menu_model_get_item_attribute (model, j, "label", "s", &j_label);
- if (str_equal0 (i_after, j_id) || str_equal0 (i_after, j_label))
+ if (dzl_str_equal0 (i_after, j_id) || dzl_str_equal0 (i_after, j_label))
{
/* You might think we need to place the item *AFTER*
* our position "j". But since we remove the row where
@@ -284,7 +283,7 @@ dzl_menu_manager_resolve_constraints (GMenu *menu)
g_menu_model_get_item_attribute (model, j, "id", "s", &j_id);
g_menu_model_get_item_attribute (model, j, "label", "s", &j_label);
- if (str_equal0 (i_before, j_id) || str_equal0 (i_before, j_label))
+ if (dzl_str_equal0 (i_before, j_id) || dzl_str_equal0 (i_before, j_label))
{
/*
* This item needs to be placed before this item we just found.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]