[gnome-builder] workbench: ensure IdeWorkbenchOpenFlags is prefixed



commit 1f5aa33e6be1f2b6ad96937754327198cd1a1d9e
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 17 03:39:27 2016 -0700

    workbench: ensure IdeWorkbenchOpenFlags is prefixed
    
    Looks like I missed this in reviews, but we always want our enum types to
    be prefixed similar to their type name for introspection and to avoid
    symbol clashes.

 libide/buffers/ide-buffer-manager.c            |    4 ++--
 libide/editor/ide-editor-perspective.c         |    5 +----
 libide/editor/ide-editor-view-actions.c        |    9 ++-------
 libide/editor/ide-editor-workbench-addin.c     |    2 +-
 libide/ide-context.c                           |    2 +-
 libide/workbench/ide-layout-stack.c            |    4 +---
 libide/workbench/ide-workbench-actions.c       |    9 ++++++---
 libide/workbench/ide-workbench.h               |    4 ++--
 plugins/build-tools/gbp-build-panel.c          |    4 +---
 plugins/command-bar/gb-vim.c                   |    9 ++-------
 plugins/file-search/gb-file-search-provider.c  |   11 ++++++++---
 plugins/project-tree/gb-project-tree-actions.c |   15 +++------------
 plugins/project-tree/gb-project-tree-builder.c |   11 ++++++++---
 tests/test-ide-buffer-manager.c                |    4 +---
 tests/test-ide-buffer.c                        |    4 +---
 15 files changed, 40 insertions(+), 57 deletions(-)
---
diff --git a/libide/buffers/ide-buffer-manager.c b/libide/buffers/ide-buffer-manager.c
index 0660e20..695232b 100644
--- a/libide/buffers/ide-buffer-manager.c
+++ b/libide/buffers/ide-buffer-manager.c
@@ -651,7 +651,7 @@ ide_buffer_manager__load_file_query_info_cb (GObject      *object,
       _ide_buffer_set_mtime (state->buffer, &tv);
     }
 
-  create_new_view = (state->flags & WORKBENCH_OPEN_FLAGS_BG) ? FALSE : state->is_new;
+  create_new_view = (state->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND) ? FALSE : state->is_new;
   g_signal_emit (self, signals [LOAD_BUFFER], 0, state->buffer, create_new_view);
 
   gtk_source_file_loader_load_async (state->loader,
@@ -766,7 +766,7 @@ ide_buffer_manager_load_file_async (IdeBufferManager     *self,
                                   "fraction", 1.0,
                                   NULL);
       g_task_return_pointer (task, g_object_ref (buffer), g_object_unref);
-      if (!(flags & WORKBENCH_OPEN_FLAGS_BG))
+      if (!(flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND))
         ide_buffer_manager_set_focus_buffer (self, buffer);
       IDE_EXIT;
     }
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index 2c8a0b7..6619238 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -599,7 +599,6 @@ ide_editor_perspective_focus_location_full (IdeEditorPerspective *self,
       IdeBufferManager *bufmgr;
       IdeWorkbench *workbench;
       IdeContext *context;
-      IdeWorkbenchOpenFlags flags;
 
       workbench = ide_widget_get_workbench (GTK_WIDGET (self));
       context = ide_workbench_get_context (workbench);
@@ -609,12 +608,10 @@ ide_editor_perspective_focus_location_full (IdeEditorPerspective *self,
       state->self = g_object_ref (self);
       state->location = ide_source_location_ref (location);
 
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
-
       ide_buffer_manager_load_file_async (bufmgr,
                                           lookup.file,
                                           FALSE,
-                                          flags,
+                                          IDE_WORKBENCH_OPEN_FLAGS_NONE,
                                           NULL,
                                           NULL,
                                           ide_editor_perspective_focus_location_cb,
diff --git a/libide/editor/ide-editor-view-actions.c b/libide/editor/ide-editor-view-actions.c
index 205093a..c80fcf9 100644
--- a/libide/editor/ide-editor-view-actions.c
+++ b/libide/editor/ide-editor-view-actions.c
@@ -518,12 +518,10 @@ find_other_file_cb (GObject      *object,
     {
       IdeWorkbench *workbench;
       GFile *gfile;
-      IdeWorkbenchOpenFlags flags;
 
       gfile = ide_file_get_file (ret);
       workbench = ide_widget_get_workbench (GTK_WIDGET (self));
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
-      ide_workbench_open_files_async (workbench, &gfile, 1, "editor", flags, NULL, NULL, NULL);
+      ide_workbench_open_files_async (workbench, &gfile, 1, "editor", IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, 
NULL, NULL);
     }
 }
 
@@ -584,7 +582,6 @@ ide_editor_view_actions_reload_buffer (GSimpleAction *action,
   IdeBufferManager *buffer_manager;
   IdeFile *file;
   g_autoptr(IdeProgress) progress = NULL;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (IDE_IS_EDITOR_VIEW (self));
 
@@ -596,12 +593,10 @@ ide_editor_view_actions_reload_buffer (GSimpleAction *action,
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (self->progress_bar), 0.0);
   gtk_widget_show (GTK_WIDGET (self->progress_bar));
 
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-
   ide_buffer_manager_load_file_async (buffer_manager,
                                       file,
                                       TRUE,
-                                      flags,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
                                       &progress,
                                       NULL,
                                       ide_editor_view_actions_reload_buffer_cb,
diff --git a/libide/editor/ide-editor-workbench-addin.c b/libide/editor/ide-editor-workbench-addin.c
index d5d2d70..6b645b9 100644
--- a/libide/editor/ide-editor-workbench-addin.c
+++ b/libide/editor/ide-editor-workbench-addin.c
@@ -225,7 +225,7 @@ ide_editor_workbench_addin_open_cb (GObject      *object,
         }
     }
 
-  if (self->perspective != NULL && !(open_file_task_data->flags & WORKBENCH_OPEN_FLAGS_BG))
+  if (self->perspective != NULL && !(open_file_task_data->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND))
     ide_editor_perspective_focus_buffer_in_current_stack (self->perspective, buffer);
 
   g_task_return_boolean (task, TRUE);
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 633f75e..be20214 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -1946,7 +1946,7 @@ restore_in_idle (gpointer user_data)
   ifile = ide_project_get_project_file (self->project, file);
   g_ptr_array_remove_index (ar, ar->len - 1);
 
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
+  flags = IDE_WORKBENCH_OPEN_FLAGS_NONE;
 
   ide_buffer_manager_load_file_async (self->buffer_manager,
                                       ifile,
diff --git a/libide/workbench/ide-layout-stack.c b/libide/workbench/ide-layout-stack.c
index ed861b2..a1ecd56 100644
--- a/libide/workbench/ide-layout-stack.c
+++ b/libide/workbench/ide-layout-stack.c
@@ -172,7 +172,6 @@ navigate_to_cb (IdeLayoutStack     *self,
 {
   IdeWorkbench *workbench;
   IdeUri *uri;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (IDE_IS_LAYOUT_STACK (self));
   g_assert (IDE_IS_BACK_FORWARD_ITEM (item));
@@ -180,8 +179,7 @@ navigate_to_cb (IdeLayoutStack     *self,
 
   uri = ide_back_forward_item_get_uri (item);
   workbench = ide_widget_get_workbench (GTK_WIDGET (self));
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-  ide_workbench_open_uri_async (workbench, uri, NULL, flags, NULL, NULL, NULL);
+  ide_workbench_open_uri_async (workbench, uri, NULL, IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, NULL);
 }
 
 static void
diff --git a/libide/workbench/ide-workbench-actions.c b/libide/workbench/ide-workbench-actions.c
index c885699..1e528bb 100644
--- a/libide/workbench/ide-workbench-actions.c
+++ b/libide/workbench/ide-workbench-actions.c
@@ -87,13 +87,16 @@ ide_workbench_actions_open_with_dialog (GSimpleAction *action,
   if (ret == GTK_RESPONSE_OK)
     {
       g_autoptr(GFile) file = NULL;
-      IdeWorkbenchOpenFlags flags;
 
       IDE_PROBE;
 
       file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
-      ide_workbench_open_files_async (self, &file, 1, NULL, flags, NULL,
+      ide_workbench_open_files_async (self,
+                                      &file,
+                                      1,
+                                      NULL,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
+                                      NULL,
                                       ide_workbench_actions_open_with_dialog_cb,
                                       NULL);
     }
diff --git a/libide/workbench/ide-workbench.h b/libide/workbench/ide-workbench.h
index b6b342a..6ffaac1 100644
--- a/libide/workbench/ide-workbench.h
+++ b/libide/workbench/ide-workbench.h
@@ -31,8 +31,8 @@ G_BEGIN_DECLS
 
 typedef enum
 {
-  WORKBENCH_OPEN_FLAGS_NONE = 0,
-  WORKBENCH_OPEN_FLAGS_BG = 1
+  IDE_WORKBENCH_OPEN_FLAGS_NONE       = 0,
+  IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND = 1 << 0,
 } IdeWorkbenchOpenFlags;
 
 #define IDE_TYPE_WORKBENCH (ide_workbench_get_type())
diff --git a/plugins/build-tools/gbp-build-panel.c b/plugins/build-tools/gbp-build-panel.c
index 7ca97a9..1634fa4 100644
--- a/plugins/build-tools/gbp-build-panel.c
+++ b/plugins/build-tools/gbp-build-panel.c
@@ -216,7 +216,6 @@ gbp_build_panel_diagnostic_activated (GbpBuildPanel *self,
   IdeDiagnostic *diagnostic;
   IdeSourceLocation *loc;
   IdeWorkbench *workbench;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (GBP_IS_BUILD_PANEL (self));
   g_assert (GTK_IS_LIST_BOX_ROW (row));
@@ -235,8 +234,7 @@ gbp_build_panel_diagnostic_activated (GbpBuildPanel *self,
     return;
 
   workbench = ide_widget_get_workbench (GTK_WIDGET (self));
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-  ide_workbench_open_uri_async (workbench, uri, "editor", flags, NULL, NULL, NULL);
+  ide_workbench_open_uri_async (workbench, uri, "editor", IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, NULL);
 }
 
 static gchar *
diff --git a/plugins/command-bar/gb-vim.c b/plugins/command-bar/gb-vim.c
index 4a05bde..322fb9e 100644
--- a/plugins/command-bar/gb-vim.c
+++ b/plugins/command-bar/gb-vim.c
@@ -447,7 +447,6 @@ gb_vim_command_edit (GtkWidget      *active_widget,
   IdeVcs *vcs;
   GFile *workdir;
   GFile *file = NULL;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (GTK_IS_WIDGET (active_widget));
 
@@ -474,8 +473,7 @@ gb_vim_command_edit (GtkWidget      *active_widget,
   else
     file = g_file_get_child (workdir, options);
 
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-  ide_workbench_open_files_async (workbench, &file, 1, "editor", flags, NULL, NULL, NULL);
+  ide_workbench_open_files_async (workbench, &file, 1, "editor", IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, 
NULL);
 
   g_clear_object (&file);
 
@@ -569,7 +567,6 @@ gb_vim_command_vsplit (GtkWidget      *active_widget,
   gchar *file_path;
   SplitCallbackData *split_callback_data;
   GVariant *variant;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (GTK_IS_WIDGET (active_widget));
 
@@ -606,9 +603,7 @@ gb_vim_command_vsplit (GtkWidget      *active_widget,
       split_callback_data->active_widget = g_object_ref (active_widget);
       split_callback_data->file_path = file_path;
 
-      flags = WORKBENCH_OPEN_FLAGS_BG;
-
-      ide_workbench_open_files_async (workbench, &file, 1, "editor", flags, NULL, gb_vim_command_vsplit_cb, 
split_callback_data);
+      ide_workbench_open_files_async (workbench, &file, 1, "editor", IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND, 
NULL, gb_vim_command_vsplit_cb, split_callback_data);
 
       g_clear_object (&file);
     }
diff --git a/plugins/file-search/gb-file-search-provider.c b/plugins/file-search/gb-file-search-provider.c
index 7bfe125..1aa1706 100644
--- a/plugins/file-search/gb-file-search-provider.c
+++ b/plugins/file-search/gb-file-search-provider.c
@@ -226,16 +226,21 @@ gb_file_search_provider_activate (IdeSearchProvider *provider,
       IdeContext *context;
       IdeVcs *vcs;
       GFile *workdir;
-      IdeWorkbenchOpenFlags flags;
 
       context = ide_workbench_get_context (IDE_WORKBENCH (toplevel));
       vcs = ide_context_get_vcs (context);
       workdir = ide_vcs_get_working_directory (vcs);
       g_object_get (result, "path", &path, NULL);
       file = g_file_get_child (workdir, path);
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
 
-      ide_workbench_open_files_async (IDE_WORKBENCH (toplevel), &file, 1, NULL, flags, NULL, NULL, NULL);
+      ide_workbench_open_files_async (IDE_WORKBENCH (toplevel),
+                                      &file,
+                                      1,
+                                      NULL,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
+                                      NULL,
+                                      NULL,
+                                      NULL);
     }
 }
 
diff --git a/plugins/project-tree/gb-project-tree-actions.c b/plugins/project-tree/gb-project-tree-actions.c
index 8cffa71..66b11cd 100644
--- a/plugins/project-tree/gb-project-tree-actions.c
+++ b/plugins/project-tree/gb-project-tree-actions.c
@@ -132,7 +132,6 @@ gb_project_tree_actions_open (GSimpleAction *action,
     {
       GFileInfo *file_info;
       GFile *file;
-      IdeWorkbenchOpenFlags flags;
 
       file_info = gb_project_file_get_file_info (GB_PROJECT_FILE (item));
       if (!file_info)
@@ -145,9 +144,7 @@ gb_project_tree_actions_open (GSimpleAction *action,
       if (!file)
         return;
 
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
-
-      ide_workbench_open_files_async (workbench, &file, 1, NULL, flags, NULL, NULL, NULL);
+      ide_workbench_open_files_async (workbench, &file, 1, NULL, IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, 
NULL);
     }
 }
 
@@ -200,7 +197,6 @@ gb_project_tree_actions_open_with_editor (GSimpleAction *action,
   GFile *file;
   IdeTreeNode *selected;
   GObject *item;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (GB_IS_PROJECT_TREE (self));
 
@@ -213,9 +209,7 @@ gb_project_tree_actions_open_with_editor (GSimpleAction *action,
       !(workbench = ide_widget_get_workbench (GTK_WIDGET (self))))
     return;
 
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-
-  ide_workbench_open_files_async (workbench, &file, 1, "editor", flags, NULL, NULL, NULL);
+  ide_workbench_open_files_async (workbench, &file, 1, "editor", IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, 
NULL);
 }
 
 static void
@@ -386,7 +380,6 @@ gb_project_tree_actions__create_cb (GObject      *object,
   g_autoptr(GError) error = NULL;
   GbProjectTree *self;
   IdeWorkbench *workbench;
-  IdeWorkbenchOpenFlags flags;
 
   g_assert (G_IS_FILE (file));
   g_assert (IDE_IS_TREE_NODE (node));
@@ -405,9 +398,7 @@ gb_project_tree_actions__create_cb (GObject      *object,
   if (workbench == NULL)
     return;
 
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
-
-  ide_workbench_open_files_async (workbench, &file, 1, NULL, flags, NULL, NULL, NULL);
+  ide_workbench_open_files_async (workbench, &file, 1, NULL, IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, 
NULL);
 
   ide_tree_node_invalidate (node);
   ide_tree_node_expand (node, FALSE);
diff --git a/plugins/project-tree/gb-project-tree-builder.c b/plugins/project-tree/gb-project-tree-builder.c
index c972d18..9712ac5 100644
--- a/plugins/project-tree/gb-project-tree-builder.c
+++ b/plugins/project-tree/gb-project-tree-builder.c
@@ -329,7 +329,6 @@ gb_project_tree_builder_node_activated (IdeTreeBuilder *builder,
       GtkWidget *workbench;
       IdeTree *tree;
       GFile *file;
-      IdeWorkbenchOpenFlags flags;
 
       if (gb_project_file_get_is_directory (GB_PROJECT_FILE (item)))
         goto failure;
@@ -343,8 +342,14 @@ gb_project_tree_builder_node_activated (IdeTreeBuilder *builder,
         goto failure;
 
       workbench = gtk_widget_get_ancestor (GTK_WIDGET (tree), IDE_TYPE_WORKBENCH);
-      flags = WORKBENCH_OPEN_FLAGS_NONE;
-      ide_workbench_open_files_async (IDE_WORKBENCH (workbench), &file, 1, NULL, flags, NULL, NULL, NULL);
+      ide_workbench_open_files_async (IDE_WORKBENCH (workbench),
+                                      &file,
+                                      1,
+                                      NULL,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
+                                      NULL,
+                                      NULL,
+                                      NULL);
 
       return TRUE;
     }
diff --git a/tests/test-ide-buffer-manager.c b/tests/test-ide-buffer-manager.c
index d2485f9..3a6d275 100644
--- a/tests/test-ide-buffer-manager.c
+++ b/tests/test-ide-buffer-manager.c
@@ -122,7 +122,6 @@ test_buffer_manager_basic_cb1 (GObject      *object,
   IdeProject *project;
   g_autofree gchar *path = NULL;
   GError *error = NULL;
-  IdeWorkbenchOpenFlags flags;
 
   context = ide_context_new_finish (result, &error);
   g_assert_no_error (error);
@@ -136,12 +135,11 @@ test_buffer_manager_basic_cb1 (GObject      *object,
 
   path = g_build_filename (g_get_current_dir (), TEST_DATA_DIR, "project1", "configure.ac", NULL);
   file = ide_project_get_file_for_path (project, path);
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
 
   ide_buffer_manager_load_file_async (buffer_manager,
                                       file,
                                       FALSE,
-                                      flags,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
                                       &progress,
                                       g_task_get_cancellable (task),
                                       test_buffer_manager_basic_cb2,
diff --git a/tests/test-ide-buffer.c b/tests/test-ide-buffer.c
index de7b3f8..4946cd1 100644
--- a/tests/test-ide-buffer.c
+++ b/tests/test-ide-buffer.c
@@ -86,7 +86,6 @@ test_buffer_basic_cb1 (GObject      *object,
   IdeBufferManager *manager;
   IdeProject *project;
   GError *error = NULL;
-  IdeWorkbenchOpenFlags flags;
 
   IDE_ENTRY;
 
@@ -98,12 +97,11 @@ test_buffer_basic_cb1 (GObject      *object,
   manager = ide_context_get_buffer_manager (context);
   project = ide_context_get_project (context);
   file = ide_project_get_file_for_path (project, "test-ide-buffer.tmp");
-  flags = WORKBENCH_OPEN_FLAGS_NONE;
 
   ide_buffer_manager_load_file_async (manager,
                                       file,
                                       FALSE,
-                                      flags,
+                                      IDE_WORKBENCH_OPEN_FLAGS_NONE,
                                       NULL,
                                       g_task_get_cancellable (task),
                                       test_buffer_basic_cb2,


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