[gnome-builder/gnome-builder-3-18] remove gb_str_empty0 to use ide_str_empty0



commit a96e103dd916c7571972544223f6b5df0a7be90b
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Fri Oct 2 12:03:57 2015 +0200

    remove gb_str_empty0 to use ide_str_empty0

 plugins/command-bar/gb-command-bar.c           |    2 +-
 plugins/command-bar/gb-vim.c                   |    4 ++--
 src/dialogs/gb-projects-dialog.c               |    2 +-
 src/editor/gb-editor-frame.c                   |    2 +-
 src/editor/gb-editor-tweak-widget.c            |    2 +-
 src/editor/gb-editor-view.c                    |    2 +-
 src/preferences/gb-preferences-page-language.c |    2 +-
 src/project-tree/gb-new-file-popover.c         |    6 +++---
 src/project-tree/gb-rename-file-popover.c      |    4 ++--
 src/search/gb-search-box.c                     |    4 ++--
 src/util/gb-string.c                           |    5 +++--
 src/util/gb-string.h                           |    2 --
 12 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/plugins/command-bar/gb-command-bar.c b/plugins/command-bar/gb-command-bar.c
index de5340a..81928f0 100644
--- a/plugins/command-bar/gb-command-bar.c
+++ b/plugins/command-bar/gb-command-bar.c
@@ -259,7 +259,7 @@ gb_command_bar_on_entry_activate (GbCommandBar *self,
 
   gtk_widget_hide (GTK_WIDGET (self->completion_scroller));
 
-  if (!gb_str_empty0 (text))
+  if (!ide_str_empty0 (text))
     {
       GbCommandResult *result = NULL;
       GbCommand *command = NULL;
diff --git a/plugins/command-bar/gb-vim.c b/plugins/command-bar/gb-vim.c
index 5003fef..61d3402 100644
--- a/plugins/command-bar/gb-vim.c
+++ b/plugins/command-bar/gb-vim.c
@@ -406,7 +406,7 @@ gb_vim_command_edit (GtkSourceView  *source_view,
   GFile *workdir;
   GFile *file = NULL;
 
-  if (gb_str_empty0 (options))
+  if (ide_str_empty0 (options))
     {
       gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "open", NULL);
       return TRUE;
@@ -442,7 +442,7 @@ gb_vim_command_tabe (GtkSourceView  *source_view,
                      const gchar    *options,
                      GError        **error)
 {
-  if (!gb_str_empty0 (options))
+  if (!ide_str_empty0 (options))
     return gb_vim_command_edit (source_view, command, options, error);
 
   gb_widget_activate_action (GTK_WIDGET (source_view), "workbench", "new-document", NULL);
diff --git a/src/dialogs/gb-projects-dialog.c b/src/dialogs/gb-projects-dialog.c
index 8422d1f..b5469d9 100644
--- a/src/dialogs/gb-projects-dialog.c
+++ b/src/dialogs/gb-projects-dialog.c
@@ -305,7 +305,7 @@ gb_projects_dialog__search_entry_changed (GbProjectsDialog *self,
   g_clear_pointer (&self->search_pattern, (GDestroyNotify)ide_pattern_spec_unref);
 
   text = gtk_entry_get_text (entry);
-  if (!gb_str_empty0 (text))
+  if (!ide_str_empty0 (text))
     self->search_pattern = ide_pattern_spec_new (text);
 
   gtk_list_box_invalidate_filter (self->listbox);
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index ae1a3fc..f670942 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -236,7 +236,7 @@ gb_editor_frame_update_search_position_label (GbEditorFrame *self)
   context = gtk_widget_get_style_context (GTK_WIDGET (self->search_entry));
   search_text = gtk_entry_get_text (GTK_ENTRY (self->search_entry));
 
-  if ((count == 0) && !gb_str_empty0 (search_text))
+  if ((count == 0) && !ide_str_empty0 (search_text))
     gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
   else
     gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
diff --git a/src/editor/gb-editor-tweak-widget.c b/src/editor/gb-editor-tweak-widget.c
index 739fafd..6c87c16 100644
--- a/src/editor/gb-editor-tweak-widget.c
+++ b/src/editor/gb-editor-tweak-widget.c
@@ -81,7 +81,7 @@ gb_editor_tweak_widget_entry_changed (GbEditorTweakWidget *self,
 
   text = gtk_entry_get_text (entry);
 
-  if (gb_str_empty0 (text))
+  if (ide_str_empty0 (text))
     gtk_list_box_set_filter_func (self->list_box, NULL, NULL, NULL);
   else
     {
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index 00a5b24..29fbf29 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -645,7 +645,7 @@ gb_editor_view_goto_line_changed (GbEditorView    *self,
 
   gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (self->document), &begin, &end);
 
-  if (!gb_str_empty0 (text))
+  if (!ide_str_empty0 (text))
     {
       gint64 value;
 
diff --git a/src/preferences/gb-preferences-page-language.c b/src/preferences/gb-preferences-page-language.c
index 29423b4..3cf66e6 100644
--- a/src/preferences/gb-preferences-page-language.c
+++ b/src/preferences/gb-preferences-page-language.c
@@ -95,7 +95,7 @@ item_filter_func (GtkListBoxRow *row,
 
   text = gtk_entry_get_text (entry);
 
-  if (gb_str_empty0 (text))
+  if (ide_str_empty0 (text))
     return TRUE;
   else
     {
diff --git a/src/project-tree/gb-new-file-popover.c b/src/project-tree/gb-new-file-popover.c
index 73c890a..6324aea 100644
--- a/src/project-tree/gb-new-file-popover.c
+++ b/src/project-tree/gb-new-file-popover.c
@@ -67,7 +67,7 @@ gb_new_file_popover__button_clicked (GbNewFilePopover *self,
     return;
 
   path = gtk_entry_get_text (self->entry);
-  if (gb_str_empty0 (path))
+  if (ide_str_empty0 (path))
     return;
 
   file = g_file_get_child (self->directory, path);
@@ -152,7 +152,7 @@ gb_new_file_popover_check_exists (GbNewFilePopover *self,
   if (directory == NULL)
     return;
 
-  if (gb_str_empty0 (path))
+  if (ide_str_empty0 (path))
     return;
 
   child = g_file_get_child (directory, path);
@@ -180,7 +180,7 @@ gb_new_file_popover__entry_changed (GbNewFilePopover *self,
 
   text = gtk_entry_get_text (entry);
 
-  gtk_widget_set_sensitive (GTK_WIDGET (self->button), !gb_str_empty0 (text));
+  gtk_widget_set_sensitive (GTK_WIDGET (self->button), !ide_str_empty0 (text));
 
   gb_new_file_popover_check_exists (self, self->directory, text);
 }
diff --git a/src/project-tree/gb-rename-file-popover.c b/src/project-tree/gb-rename-file-popover.c
index 0951969..0fd7b61 100644
--- a/src/project-tree/gb-rename-file-popover.c
+++ b/src/project-tree/gb-rename-file-popover.c
@@ -164,7 +164,7 @@ gb_rename_file_popover__entry_changed (GbRenameFilePopover *self,
   gtk_label_set_label (self->message, NULL);
 
   text = gtk_entry_get_text (entry);
-  if (gb_str_empty0 (text))
+  if (ide_str_empty0 (text))
     return;
 
   if (strchr (text, G_DIR_SEPARATOR) != NULL)
@@ -219,7 +219,7 @@ gb_rename_file_popover__button_clicked (GbRenameFilePopover *self,
   g_assert (G_IS_FILE (self->file));
 
   path = gtk_entry_get_text (self->entry);
-  if (gb_str_empty0 (path))
+  if (ide_str_empty0 (path))
     return;
 
   parent = g_file_get_parent (self->file);
diff --git a/src/search/gb-search-box.c b/src/search/gb-search-box.c
index e3c6c80..606e451 100644
--- a/src/search/gb-search-box.c
+++ b/src/search/gb-search-box.c
@@ -131,7 +131,7 @@ gb_search_box_entry_focus_in (GbSearchBox   *self,
 
   text = gtk_entry_get_text (GTK_ENTRY (self->entry));
 
-  if (!gb_str_empty0 (text))
+  if (!ide_str_empty0 (text))
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->button), TRUE);
 
   return GDK_EVENT_PROPAGATE;
@@ -164,7 +164,7 @@ gb_search_box_entry_changed (GbSearchBox    *self,
 
   button = GTK_TOGGLE_BUTTON (self->button);
   text = gtk_entry_get_text (GTK_ENTRY (entry));
-  active = !gb_str_empty0 (text) ||
+  active = !ide_str_empty0 (text) ||
            (self->delay_timeout != 0) ||
            gtk_widget_has_focus (GTK_WIDGET (entry));
 
diff --git a/src/util/gb-string.c b/src/util/gb-string.c
index bea59aa..0c78f2f 100644
--- a/src/util/gb-string.c
+++ b/src/util/gb-string.c
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <ide.h>
 #include <string.h>
 
 #include "gb-string.h"
@@ -79,9 +80,9 @@ gboolean
 gb_str_simple_match (const gchar *haystack,
                      const gchar *needle_down)
 {
-  if (gb_str_empty0 (haystack))
+  if (ide_str_empty0 (haystack))
     return FALSE;
-  else if (gb_str_empty0 (needle_down))
+  else if (ide_str_empty0 (needle_down))
     return TRUE;
 
   for (; *needle_down; needle_down = g_utf8_next_char (needle_down))
diff --git a/src/util/gb-string.h b/src/util/gb-string.h
index 9673273..bf8dbc3 100644
--- a/src/util/gb-string.h
+++ b/src/util/gb-string.h
@@ -23,8 +23,6 @@
 
 G_BEGIN_DECLS
 
-#define gb_str_empty(s)  (!*(s))
-#define gb_str_empty0(s) (!(s) || gb_str_empty(s))
 #define gb_str_equal0(s1,s2) \
   (((s1) == (s2)) || ((s1) && (s2) && g_str_equal(s1,s2)))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]