static void ide_git_vcs__monitor_changed_cb (IdeGitVcs *self, GFile *file, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { g_autofree gchar *name = NULL; g_autofree gchar *other_name = NULL; IDE_ENTRY; g_assert (IDE_IS_GIT_VCS (self)); g_assert (G_IS_FILE (file)); g_assert (!other_file || G_IS_FILE (other_file)); name = g_file_get_basename (file); if (other_file != NULL) other_name = g_file_get_basename (other_file); if (dzl_str_equal0 (name, "index") || dzl_str_equal0 (other_name, "index")) { dzl_clear_source (&self->changed_timeout); self->changed_timeout = g_timeout_add_seconds (DEFAULT_CHANGED_TIMEOUT_SECS, ide_git_vcs__changed_timeout_cb, self); } IDE_EXIT; }
static void ide_application_plugins_enabled_changed (IdeApplication *self, const gchar *key, GSettings *settings) { PeasPluginInfo *plugin_info; PeasEngine *engine; gboolean enabled; g_assert (IDE_IS_APPLICATION (self)); g_assert (dzl_str_equal0 (key, "enabled")); g_assert (G_IS_SETTINGS (settings)); enabled = g_settings_get_boolean (settings, key); engine = peas_engine_get_default (); plugin_info = g_object_get_data (G_OBJECT (settings), "PEAS_PLUGIN_INFO"); g_assert (plugin_info != NULL); if (enabled && ide_application_can_load_plugin (self, plugin_info) && !peas_plugin_info_is_loaded (plugin_info)) peas_engine_load_plugin (engine, plugin_info); else if (!enabled && peas_plugin_info_is_loaded (plugin_info)) peas_engine_unload_plugin (engine, plugin_info); }
gboolean ide_ctags_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 (dzl_str_equal0 (dotptr, allowed [i])) return TRUE; } return FALSE; }
void ide_keybindings_set_mode (IdeKeybindings *self, const gchar *mode) { g_return_if_fail (IDE_IS_KEYBINDINGS (self)); if (!dzl_str_equal0 (self->mode, mode)) { g_free (self->mode); self->mode = g_strdup (mode); if (self->constructed) ide_keybindings_reload (self); g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MODE]); } }
const gchar * list_get_attribute (const guchar **attributes, const gchar *name) { const guchar **l = attributes; g_return_val_if_fail (!dzl_str_empty0 (name), NULL); if (attributes == NULL) return NULL; while (l [0] != NULL) { if (dzl_str_equal0 (name, l [0])) return (const gchar *)l [1]; l += 2; } return NULL; }
static void ide_compile_commands_filter_c (IdeCompileCommands *self, const CompileInfo *info, const gchar * const *system_includes, gchar ***argv) { g_autoptr(GPtrArray) ar = NULL; g_assert (IDE_IS_COMPILE_COMMANDS (self)); g_assert (info != NULL); g_assert (argv != NULL); if (*argv == NULL) return; ar = g_ptr_array_new_with_free_func (g_free); if (system_includes != NULL) { for (guint i = 0; system_includes[i]; i++) g_ptr_array_add (ar, g_strdup_printf ("-I%s", system_includes[i])); } for (guint i = 0; (*argv)[i] != NULL; i++) { const gchar *param = (*argv)[i]; const gchar *next = (*argv)[i+1]; g_autofree gchar *resolved = NULL; if (param[0] != '-') continue; switch (param[1]) { case 'I': /* -I/usr/include, -I /usr/include */ if (param[2] != '\0') next = ¶m[2]; resolved = ide_compile_commands_resolve (self, info, next); if (resolved != NULL) g_ptr_array_add (ar, g_strdup_printf ("-I%s", resolved)); break; case 'f': /* -fPIC */ case 'W': /* -Werror... */ case 'm': /* -m64 -mtune=native */ case 'O': /* -O2 */ g_ptr_array_add (ar, g_strdup (param)); break; case 'M': /* -MMD -MQ -MT -MF <file> */ /* ignore the -M class of commands */ break; case 'D': /* -DFOO, -D FOO */ case 'x': /* -xc++ */ g_ptr_array_add (ar, g_strdup (param)); if (param[2] == '\0') g_ptr_array_add (ar, g_strdup (next)); break; default: if (g_str_has_prefix (param, "-std=") || dzl_str_equal0 (param, "-pthread") || g_str_has_prefix (param, "-isystem")) { g_ptr_array_add (ar, g_strdup (param)); } else if (next != NULL && dzl_str_equal0 (param, "-include")) { g_ptr_array_add (ar, g_strdup (param)); g_ptr_array_add (ar, ide_compile_commands_resolve (self, info, next)); } break; } } g_ptr_array_add (ar, NULL); g_strfreev (*argv); *argv = (gchar **)g_ptr_array_free (g_steal_pointer (&ar), FALSE); }