void ide_workbench_set_visible_perspective (IdeWorkbench *self, IdePerspective *perspective) { GActionGroup *actions; GtkStack *stack; gchar *id; g_return_if_fail (IDE_IS_WORKBENCH (self)); g_return_if_fail (IDE_IS_PERSPECTIVE (perspective)); stack = GTK_STACK (gtk_widget_get_ancestor (GTK_WIDGET (perspective), GTK_TYPE_STACK)); id = ide_perspective_get_id (perspective); if (!ide_str_equal0 (gtk_stack_get_visible_child_name (stack), id)) { gtk_stack_set_visible_child_name (stack, id); gtk_stack_set_visible_child_name (self->titlebar_stack, id); } g_free (id); actions = ide_perspective_get_actions (perspective); gtk_widget_insert_action_group (GTK_WIDGET (self), "perspective", actions); if ((stack == self->perspectives_stack) && !ide_str_equal0 (gtk_stack_get_visible_child_name (self->top_stack), "perspectives")) { gtk_stack_set_visible_child_name (self->top_stack, "perspectives"); g_timeout_add (1000 + gtk_stack_get_transition_duration (self->top_stack), remove_early_perspectives, g_object_ref (self)); } }
static void gb_slider_add_child (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *type) { GbSliderPosition position = GB_SLIDER_NONE; g_assert (GTK_IS_BUILDABLE (buildable)); g_assert (GTK_IS_BUILDER (builder)); g_assert (G_IS_OBJECT (child)); if (!GTK_IS_WIDGET (child)) { g_warning ("Child \"%s\" must be of type GtkWidget.", g_type_name (G_OBJECT_TYPE (child))); return; } if (ide_str_equal0 (type, "bottom")) position = GB_SLIDER_BOTTOM; else if (ide_str_equal0 (type, "top")) position = GB_SLIDER_TOP; else if (ide_str_equal0 (type, "left")) position = GB_SLIDER_LEFT; else if (ide_str_equal0 (type, "right")) position = GB_SLIDER_RIGHT; gtk_container_add_with_properties (GTK_CONTAINER (buildable), GTK_WIDGET (child), "position", position, NULL); }
static gboolean looks_like_makefile (IdeBuffer *buffer) { GtkSourceLanguage *language; const gchar *path; IdeFile *file; g_assert (IDE_IS_BUFFER (buffer)); file = ide_buffer_get_file (buffer); path = ide_file_get_path (file); if (path != NULL) { if (g_str_has_suffix (path, "Makefile.am") || g_str_has_suffix (path, ".mk")) return TRUE; } language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (buffer)); if (language != NULL) { const gchar *lang_id; lang_id = gtk_source_language_get_id (language); if (ide_str_equal0 (lang_id, "automake") || ide_str_equal0 (lang_id, "makefile")) return TRUE; } return FALSE; }
void ide_application_actions_update (IdeApplication *self) { GList *windows; GAction *action; gboolean enabled; g_assert (IDE_IS_APPLICATION (self)); /* * We only enable the preferences action if we have a workbench open * that is past the greeter. */ action = g_action_map_lookup_action (G_ACTION_MAP (self), "preferences"); enabled = FALSE; for (windows = gtk_application_get_windows (GTK_APPLICATION (self)); windows != NULL; windows = windows->next) { GtkWindow *window = windows->data; if (IDE_IS_WORKBENCH (window) && !ide_str_equal0 ("greeter", ide_workbench_get_visible_perspective_name (IDE_WORKBENCH (window)))) { enabled = TRUE; break; } } g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled); }
static gboolean find_child_node (IdeTree *tree, IdeTreeNode *node, IdeTreeNode *child, gpointer user_data) { const gchar *name = user_data; GObject *item; g_assert (IDE_IS_TREE (tree)); g_assert (IDE_IS_TREE_NODE (node)); g_assert (IDE_IS_TREE_NODE (child)); item = ide_tree_node_get_item (child); if (GB_IS_PROJECT_FILE (item)) { const gchar *item_name; item_name = gb_project_file_get_display_name (GB_PROJECT_FILE (item)); return ide_str_equal0 (item_name, name); } return FALSE; }
static void ide_preferences_builtin_register_languages (IdePreferences *preferences) { GtkSourceLanguageManager *manager; const gchar * const *language_ids; g_autoptr(GHashTable) sections = NULL; guint section_count = 0; gint i; sections = g_hash_table_new (g_str_hash, g_str_equal); ide_preferences_add_page (preferences, "languages", _("Programming Languages"), 200); manager = gtk_source_language_manager_get_default (); language_ids = gtk_source_language_manager_get_language_ids (manager); for (i = 0; language_ids [i]; i++) { IdePreferencesLanguageRow *row; GtkSourceLanguage *language; const gchar *name; const gchar *section; if (ide_str_equal0 (language_ids [i], "def")) continue; language = gtk_source_language_manager_get_language (manager, language_ids [i]); name = gtk_source_language_get_name (language); section = gtk_source_language_get_section (language); if (!g_hash_table_contains (sections, section)) { ide_preferences_add_list_group (preferences, "languages", section, section, section_count++); g_hash_table_insert (sections, (gchar *)section, NULL); } row = g_object_new (IDE_TYPE_PREFERENCES_LANGUAGE_ROW, "id", language_ids [i], "title", name, "visible", TRUE, NULL); ide_preferences_add_custom (preferences, "languages", section, GTK_WIDGET (row), NULL, 0); } ide_preferences_add_page (preferences, "languages.id", NULL, 0); ide_preferences_add_list_group (preferences, "languages.id", "basic", NULL, 0); ide_preferences_add_switch (preferences, "languages.id", "basic", "org.gnome.builder.editor.language", "trim-trailing-whitespace", "/org/gnome/builder/editor/language/{id}/", NULL, _("Trim trailing whitespace"), _("Upon saving, trailing whitespace from modified lines will be trimmed."), NULL, 10); ide_preferences_add_switch (preferences, "languages.id", "basic", "org.gnome.builder.editor.language", "overwrite-braces", "/org/gnome/builder/editor/language/{id}/", NULL, _("Overwrite Braces"), _("Overwrite closing braces"), NULL, 20); ide_preferences_add_list_group (preferences, "languages.id", "margin", _("Margins"), 0); ide_preferences_add_radio (preferences, "languages.id", "margin", "org.gnome.builder.editor.language", "show-right-margin", "/org/gnome/builder/editor/language/{id}/", NULL, _("Show right margin"), NULL, NULL, 0); ide_preferences_add_spin_button (preferences, "languages.id", "margin", "org.gnome.builder.editor.language", "right-margin-position", "/org/gnome/builder/editor/language/{id}/", _("Right margin position"), _("Position in spaces for the right margin"), NULL, 10); ide_preferences_add_list_group (preferences, "languages.id", "indentation", _("Indentation"), 100); ide_preferences_add_spin_button (preferences, "languages.id", "indentation", "org.gnome.builder.editor.language", "tab-width", "/org/gnome/builder/editor/language/{id}/", _("Tab width"), _("Width of a tab character in spaces"), NULL, 10); ide_preferences_add_radio (preferences, "languages.id", "indentation", "org.gnome.builder.editor.language", "insert-spaces-instead-of-tabs", "/org/gnome/builder/editor/language/{id}/", NULL, _("Insert spaces instead of tabs"), _("Prefer spaces over use of tabs"), NULL, 20); ide_preferences_add_radio (preferences, "languages.id", "indentation", "org.gnome.builder.editor.language", "auto-indent", "/org/gnome/builder/editor/language/{id}/", NULL, _("Automatically indent"), _("Indent source code as you type"), NULL, 30); }
static inline gboolean too_similar (const IdeCtagsIndexEntry *a, const IdeCtagsIndexEntry *b) { if (a->kind == b->kind) { if (ide_str_equal0 (a->name, b->name)) return TRUE; } return FALSE; }
static void ide_doap_set_homepage (IdeDoap *self, const gchar *homepage) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->homepage, homepage)) { g_free (self->homepage); self->homepage = g_strdup (homepage); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HOMEPAGE]); } }
static void ide_doap_set_bug_database (IdeDoap *self, const gchar *bug_database) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->bug_database, bug_database)) { g_free (self->bug_database); self->bug_database = g_strdup (bug_database); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BUG_DATABASE]); } }
static void ide_doap_set_shortdesc (IdeDoap *self, const gchar *shortdesc) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->shortdesc, shortdesc)) { g_free (self->shortdesc); self->shortdesc = g_strdelimit (g_strdup (shortdesc), "\n", ' '); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SHORTDESC]); } }
void ide_project_info_set_name (IdeProjectInfo *self, const gchar *name) { g_return_if_fail (IDE_IS_PROJECT_INFO (self)); if (!ide_str_equal0 (self->name, name)) { g_free (self->name); self->name = g_strdup (name); g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_NAME]); } }
static void ide_doap_set_download_page (IdeDoap *self, const gchar *download_page) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->download_page, download_page)) { g_free (self->download_page); self->download_page = g_strdup (download_page); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DOWNLOAD_PAGE]); } }
static void ide_doap_set_name (IdeDoap *self, const gchar *name) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->name, name)) { g_free (self->name); self->name = g_strdup (name); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_NAME]); } }
static void ide_doap_set_description (IdeDoap *self, const gchar *description) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->description, description)) { g_free (self->description); self->description = g_strdup (description); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DESCRIPTION]); } }
static void ide_doap_set_category (IdeDoap *self, const gchar *category) { g_return_if_fail (IDE_IS_DOAP (self)); if (!ide_str_equal0 (self->category, category)) { g_free (self->category); self->category = g_strdup (category); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CATEGORY]); } }
void ide_project_info_set_description (IdeProjectInfo *self, const gchar *description) { g_return_if_fail (IDE_IS_PROJECT_INFO (self)); if (!ide_str_equal0 (self->description, description)) { g_free (self->description); self->description = g_strdup (description); g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_DESCRIPTION]); } }
static void ide_settings_set_schema_id (IdeSettings *self, const gchar *schema_id) { g_assert (IDE_IS_SETTINGS (self)); g_assert (schema_id != NULL); if (!ide_str_equal0 (schema_id, self->schema_id)) { g_free (self->schema_id); self->schema_id = g_strdup (schema_id); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SCHEMA_ID]); } }
static void ide_application_actions_preferences (GSimpleAction *action, GVariant *parameter, gpointer user_data) { IdeApplication *self = user_data; GList *windows; IDE_ENTRY; g_assert (IDE_IS_APPLICATION (self)); /* * TODO: Make this work at the greeter screen too. */ windows = gtk_application_get_windows (GTK_APPLICATION (self)); for (; windows; windows = windows->next) { GtkWindow *window = windows->data; const gchar *name; if (!IDE_IS_WORKBENCH (window)) continue; name = ide_workbench_get_visible_perspective_name (IDE_WORKBENCH (window)); if (!ide_str_equal0 (name, "greeter") && !ide_str_equal0 (name, "genesis")) { ide_workbench_set_visible_perspective_name (IDE_WORKBENCH (window), "preferences"); IDE_EXIT; } } IDE_EXIT; }
static gboolean is_allowed (const IdeCtagsIndexEntry *entry, const gchar * const *allowed) { if (allowed) { const gchar *dotptr = strrchr (entry->path, '.'); gsize i; for (i = 0; allowed [i]; i++) if (ide_str_equal0 (dotptr, allowed [i])) return TRUE; } return FALSE; }
static void ide_settings_set_relative_path (IdeSettings *self, const gchar *relative_path) { g_assert (IDE_IS_SETTINGS (self)); g_assert (relative_path != NULL); if (*relative_path == '/') relative_path++; if (!ide_str_equal0 (relative_path, self->relative_path)) { g_free (self->relative_path); self->relative_path = g_strdup (relative_path); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_RELATIVE_PATH]); } }
static void populate_cache_cb (EggTaskCache *cache, gconstpointer key, GTask *task, gpointer user_data) { IdeAutotoolsBuildSystem *self = user_data; IDE_ENTRY; g_assert (IDE_IS_AUTOTOOLS_BUILD_SYSTEM (self)); g_assert (ide_str_equal0 (key, MAKECACHE_KEY)); g_assert (G_IS_TASK (task)); ide_autotools_build_system_get_local_makefile_async (self, g_task_get_cancellable (task), populate_cache__get_local_makefile_cb, g_object_ref (task)); IDE_EXIT; }
void ide_workbench_set_visible_perspective (IdeWorkbench *self, IdePerspective *perspective) { g_autofree gchar *id = NULL; GActionGroup *actions = NULL; const gchar *current_id; GtkWidget *titlebar; guint restore_duration = 0; g_return_if_fail (IDE_IS_WORKBENCH (self)); g_return_if_fail (IDE_IS_PERSPECTIVE (perspective)); /* * If we can detect that this is the first transition to the editor, * and that our window is not yet displayed, we can avoid the transition * duration altogether. This is handy when first opening a window with * a project loaded, as used by self->disable_greeter. */ if (self->disable_greeter && IDE_IS_EDITOR_PERSPECTIVE (perspective) && !self->did_initial_editor_transition) { self->did_initial_editor_transition = TRUE; restore_duration = gtk_stack_get_transition_duration (self->perspectives_stack); gtk_stack_set_transition_duration (self->perspectives_stack, 0); } current_id = gtk_stack_get_visible_child_name (self->perspectives_stack); id = ide_perspective_get_id (perspective); if (!ide_str_equal0 (current_id, id)) gtk_stack_set_visible_child_name (self->perspectives_stack, id); titlebar = gtk_stack_get_child_by_name (self->header_stack, id); if (titlebar != NULL) gtk_stack_set_visible_child (self->header_stack, titlebar); else gtk_stack_set_visible_child (self->header_stack, GTK_WIDGET (self->header_bar)); actions = ide_perspective_get_actions (perspective); gtk_widget_insert_action_group (GTK_WIDGET (self), "perspective", actions); /* * If we are transitioning to the editor the first time, we can * remove the early perspectives (greeter, etc). */ if (IDE_IS_EDITOR_PERSPECTIVE (perspective)) remove_early_perspectives (self); gtk_widget_set_visible (GTK_WIDGET (self->perspective_menu_button), !ide_perspective_is_early (perspective)); if (self->addins != NULL) peas_extension_set_foreach (self->addins, ide_workbench_notify_perspective_set, perspective); g_clear_object (&actions); if (restore_duration != 0) gtk_stack_set_transition_duration (self->perspectives_stack, restore_duration); /* Notify the application to possibly update actions such * as the preferences state. */ ide_application_actions_update (IDE_APPLICATION_DEFAULT); }
static void ide_ctags_completion_provider_populate (GtkSourceCompletionProvider *provider, GtkSourceCompletionContext *context) { IdeCtagsCompletionProvider *self = (IdeCtagsCompletionProvider *)provider; const gchar * const *allowed; g_autofree gchar *casefold = NULL; gint word_len; guint i; guint j; IDE_ENTRY; g_assert (IDE_IS_CTAGS_COMPLETION_PROVIDER (self)); g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context)); g_clear_pointer (&self->current_word, g_free); self->current_word = ide_completion_provider_context_current_word (context); allowed = get_allowed_suffixes (context); if (self->results != NULL) { if (ide_completion_results_replay (self->results, self->current_word)) { ide_completion_results_present (self->results, provider, context); IDE_EXIT; } g_clear_pointer (&self->results, g_object_unref); } word_len = strlen (self->current_word); if (word_len < self->minimum_word_size) IDE_GOTO (word_too_small); casefold = g_utf8_casefold (self->current_word, -1); self->results = ide_completion_results_new (self->current_word); for (i = 0; i < self->indexes->len; i++) { g_autofree gchar *copy = g_strdup (self->current_word); IdeCtagsIndex *index = g_ptr_array_index (self->indexes, i); const IdeCtagsIndexEntry *entries = NULL; const gchar *last_name = NULL; guint tmp_len = word_len; gsize n_entries = 0; while (entries == NULL && *copy) { if (!(entries = ide_ctags_index_lookup_prefix (index, copy, &n_entries))) copy [--tmp_len] = '\0'; } if ((entries == NULL) || (n_entries == 0)) continue; for (j = 0; j < n_entries; j++) { const IdeCtagsIndexEntry *entry = &entries [j]; IdeCtagsCompletionItem *item; if (ide_str_equal0 (entry->name, last_name)) continue; last_name = entry->name; if (!ide_ctags_is_allowed (entry, allowed)) continue; item = ide_ctags_completion_item_new (self, entry); if (!ide_completion_item_match (IDE_COMPLETION_ITEM (item), self->current_word, casefold)) { g_object_unref (item); continue; } ide_completion_results_take_proposal (self->results, IDE_COMPLETION_ITEM (item)); } } ide_completion_results_present (self->results, provider, context); IDE_EXIT; word_too_small: gtk_source_completion_context_add_proposals (context, provider, NULL, TRUE); IDE_EXIT; }
gboolean ide_doap_load_from_file (IdeDoap *self, GFile *file, GCancellable *cancellable, GError **error) { g_autoptr(XmlReader) reader = NULL; g_return_val_if_fail (IDE_IS_DOAP (self), FALSE); g_return_val_if_fail (G_IS_FILE (file), FALSE); g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE); reader = xml_reader_new (); if (!xml_reader_load_from_file (reader, file, cancellable, error)) return FALSE; if (!xml_reader_read_start_element (reader, "Project")) { g_set_error (error, IDE_DOAP_ERROR, IDE_DOAP_ERROR_INVALID_FORMAT, "Project element is missing from doap."); return FALSE; } g_object_freeze_notify (G_OBJECT (self)); xml_reader_read (reader); do { const gchar *element_name; element_name = xml_reader_get_local_name (reader); if (ide_str_equal0 (element_name, "name") || ide_str_equal0 (element_name, "shortdesc") || ide_str_equal0 (element_name, "description")) { gchar *str; str = xml_reader_read_string (reader); if (str != NULL) g_object_set (self, element_name, g_strstrip (str), NULL); g_free (str); } else if (ide_str_equal0 (element_name, "category") || ide_str_equal0 (element_name, "homepage") || ide_str_equal0 (element_name, "download-page") || ide_str_equal0 (element_name, "bug-database")) { gchar *str; str = xml_reader_get_attribute (reader, "rdf:resource"); if (str != NULL) g_object_set (self, element_name, g_strstrip (str), NULL); g_free (str); } else if (ide_str_equal0 (element_name, "programming-language")) { gchar *str; str = xml_reader_read_string (reader); if (!ide_str_empty0 (str)) ide_doap_add_language (self, g_strstrip (str)); g_free (str); } else if (ide_str_equal0 (element_name, "maintainer")) { if (!ide_doap_parse_maintainer (self, reader)) break; } } while (xml_reader_read_to_next (reader)); g_object_thaw_notify (G_OBJECT (self)); return TRUE; }
static void vagrant_status_cb (GbpVagrantRuntimeProvider *self, GAsyncResult *result, gpointer user_data) { g_autoptr(GbpVagrantTable) table = NULL; g_autoptr(GbpVagrantRuntime) runtime = NULL; g_autoptr(IdeTask) task = user_data; g_autoptr(GError) error = NULL; GbpVagrantTableIter iter; g_assert (GBP_IS_VAGRANT_RUNTIME_PROVIDER (self)); g_assert (G_IS_ASYNC_RESULT (result)); g_assert (IDE_IS_TASK (task)); if (!(table = gbp_vagrant_runtime_provider_command_finish (self, result, &error))) { ide_task_return_error (task, g_steal_pointer (&error)); return; } gbp_vagrant_table_iter_init (&iter, table); while (gbp_vagrant_table_iter_next (&iter)) { g_autofree gchar *id = NULL; g_autofree gchar *key = NULL; g_autofree gchar *val1 = NULL; id = gbp_vagrant_table_iter_get_column (&iter, 1); key = gbp_vagrant_table_iter_get_column (&iter, 2); val1 = gbp_vagrant_table_iter_get_column (&iter, 3); if (ide_str_empty0 (id)) continue; if (runtime != NULL) { const gchar *prev_id = gbp_vagrant_runtime_get_vagrant_id (runtime); if (!ide_str_equal0 (id, prev_id)) { gbp_vagrant_runtime_provider_add (self, runtime); g_clear_object (&runtime); } } else { g_autofree gchar *runtime_id = g_strdup_printf ("vagrant:%s", id); runtime = g_object_new (GBP_TYPE_VAGRANT_RUNTIME, "id", runtime_id, "category", _("Vagrant"), "name", id, "vagrant-id", id, NULL); } if (ide_str_equal0 (key, "provider-name")) gbp_vagrant_runtime_set_provider (runtime, val1); else if (ide_str_equal0 (key, "state")) gbp_vagrant_runtime_set_state (runtime, val1); } if (runtime != NULL) { gbp_vagrant_runtime_provider_add (self, runtime); g_clear_object (&runtime); } ide_task_return_boolean (task, TRUE); }
static void ide_preferences_spin_button_connect (IdePreferencesBin *bin, GSettings *settings) { IdePreferencesSpinButton *self = (IdePreferencesSpinButton *)bin; GSettingsSchema *schema = NULL; GSettingsSchemaKey *key = NULL; GVariant *range = NULL; GVariant *values = NULL; GVariant *lower = NULL; GVariant *upper = NULL; gchar *type = NULL; gchar *signal_detail = NULL; GtkAdjustment *adj; GVariantIter iter; g_assert (IDE_IS_PREFERENCES_SPIN_BUTTON (self)); self->settings = g_object_ref (settings); g_object_get (self->settings, "settings-schema", &schema, NULL); adj = gtk_spin_button_get_adjustment (self->spin_button); key = g_settings_schema_get_key (schema, self->key); range = g_settings_schema_key_get_range (key); g_variant_get (range, "(sv)", &type, &values); if (!ide_str_equal0 (type, "range") || (2 != g_variant_iter_init (&iter, values))) { gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE); goto cleanup; } lower = g_variant_iter_next_value (&iter); upper = g_variant_iter_next_value (&iter); self->type = g_variant_get_type (lower); apply_value (adj, lower, "lower"); apply_value (adj, upper, "upper"); signal_detail = g_strdup_printf ("changed::%s", self->key); self->handler = g_signal_connect_object (self->settings, signal_detail, G_CALLBACK (ide_preferences_spin_button_setting_changed), self, G_CONNECT_SWAPPED); ide_preferences_spin_button_setting_changed (self, self->key, self->settings); cleanup: g_clear_pointer (&key, g_settings_schema_key_unref); g_clear_pointer (&type, g_free); g_clear_pointer (&signal_detail, g_free); g_clear_pointer (&range, g_variant_unref); g_clear_pointer (&values, g_variant_unref); g_clear_pointer (&lower, g_variant_unref); g_clear_pointer (&upper, g_variant_unref); g_clear_pointer (&schema, g_settings_schema_unref); }
static void ide_editor_frame_update_ruler (IdeEditorFrame *self) { const gchar *mode_display_name; const gchar *mode_name; GtkTextBuffer *buffer; gboolean visible = FALSE; g_assert (IDE_IS_EDITOR_FRAME (self)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view)); if (!IDE_IS_BUFFER (buffer)) return; /* update line/column text */ if (self->show_ruler) { g_autofree gchar *text = NULL; guint ln = 0; guint col = 0; ide_source_view_get_visual_position (self->source_view, &ln, &col); text = g_strdup_printf (_("Line %u, Column %u"), ln + 1, col + 1); nautilus_floating_bar_set_primary_label (self->floating_bar, text); visible = TRUE; } else { nautilus_floating_bar_set_primary_label (self->floating_bar, NULL); } /* update current mode */ mode_display_name = ide_source_view_get_mode_display_name (self->source_view); gtk_label_set_label (self->mode_name_label, mode_display_name); gtk_widget_set_visible (GTK_WIDGET (self->mode_name_label), !!mode_display_name); if (mode_display_name != NULL) visible = TRUE; /* * Update overwrite label. * * XXX: Hack for 3.18 to ensure we don't have "OVR Replace" in vim mode. */ mode_name = ide_source_view_get_mode_name (self->source_view); if (ide_source_view_get_overwrite (self->source_view) && !ide_str_equal0 (mode_name, "vim-replace")) { gtk_widget_set_visible (GTK_WIDGET (self->overwrite_label), TRUE); visible = TRUE; } else { gtk_widget_set_visible (GTK_WIDGET (self->overwrite_label), FALSE); } if (gtk_widget_get_visible (GTK_WIDGET (self->mode_name_label))) visible = TRUE; if (ide_buffer_get_busy (IDE_BUFFER (buffer))) { nautilus_floating_bar_set_show_spinner (self->floating_bar, TRUE); visible = TRUE; } else { nautilus_floating_bar_set_show_spinner (self->floating_bar, FALSE); } /* we don't fade while hiding because we likely won't have * any text labels set anyway. */ if (!visible && gtk_widget_get_visible (GTK_WIDGET (self->floating_bar))) gtk_widget_hide (GTK_WIDGET (self->floating_bar)); else if (visible && !gtk_widget_get_visible (GTK_WIDGET (self->floating_bar))) gtk_widget_show (GTK_WIDGET (self->floating_bar)); }