[gnome-builder/wip/gtk4-port: 391/1774] plugins/vim: be more careful about getting access to widgets




commit 4a8e0d843874753a4caa9206b21cfefece4330ae
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 5 12:01:23 2022 -0700

    plugins/vim: be more careful about getting access to widgets

 src/plugins/vim/gbp-vim-editor-page-addin.c | 7 +++----
 src/plugins/vim/gbp-vim-workspace-addin.c   | 7 +++++--
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/vim/gbp-vim-editor-page-addin.c b/src/plugins/vim/gbp-vim-editor-page-addin.c
index dc80667c7..247be0f86 100644
--- a/src/plugins/vim/gbp-vim-editor-page-addin.c
+++ b/src/plugins/vim/gbp-vim-editor-page-addin.c
@@ -101,10 +101,9 @@ gbp_vim_editor_page_addin_update (GbpVimEditorPageAddin *self)
       self->workspace_addin = NULL;
     }
 
-  workspace = ide_widget_get_workspace (GTK_WIDGET (self->page));
-  workspace_addin = ide_workspace_addin_find_by_module_name (workspace, "vim");
-
-  if (workspace_addin == NULL || !GBP_IS_VIM_WORKSPACE_ADDIN (workspace_addin))
+  if (!(workspace = ide_widget_get_workspace (GTK_WIDGET (self->page))) ||
+      !(workspace_addin = ide_workspace_addin_find_by_module_name (workspace, "vim")) ||
+      !GBP_IS_VIM_WORKSPACE_ADDIN (workspace_addin))
     IDE_GOTO (disabled);
 
   self->workspace_addin = GBP_VIM_WORKSPACE_ADDIN (workspace_addin);
diff --git a/src/plugins/vim/gbp-vim-workspace-addin.c b/src/plugins/vim/gbp-vim-workspace-addin.c
index cef9ee7d0..416e66a4e 100644
--- a/src/plugins/vim/gbp-vim-workspace-addin.c
+++ b/src/plugins/vim/gbp-vim-workspace-addin.c
@@ -219,8 +219,11 @@ gbp_vim_workspace_addin_set_command (GbpVimWorkspaceAddin *self,
 {
   g_return_if_fail (GBP_IS_VIM_WORKSPACE_ADDIN (self));
 
-  gtk_label_set_label (self->command, command);
-  gtk_widget_set_visible (GTK_WIDGET (self->command), command && *command);
+  if (self->command != NULL)
+    {
+      gtk_label_set_label (self->command, command);
+      gtk_widget_set_visible (GTK_WIDGET (self->command), !ide_str_empty0 (command));
+    }
 }
 
 void


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