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; }
static void ide_file_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { IdeFile *self = (IdeFile *)object; switch (prop_id) { case PROP_FILE: g_value_set_object (value, ide_file_get_file (self)); break; case PROP_IS_TEMPORARY: g_value_set_boolean (value, ide_file_get_is_temporary (self)); break; case PROP_LANGUAGE: g_value_set_object (value, ide_file_get_language (self)); break; case PROP_PATH: g_value_set_string (value, ide_file_get_path (self)); break; case PROP_TEMPORARY_ID: g_value_set_uint (value, ide_file_get_temporary_id (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void ide_editor_perspective_focus_location_full (IdeEditorPerspective *self, IdeSourceLocation *location, gboolean open_if_not_found) { struct { IdeFile *file; IdeEditorView *view; } lookup = { 0 }; GtkWidget *stack; guint line; guint line_offset; IDE_ENTRY; g_assert (IDE_IS_EDITOR_PERSPECTIVE (self)); g_assert (location != NULL); lookup.file = ide_source_location_get_file (location); lookup.view = NULL; if (lookup.file == NULL) { g_warning ("IdeSourceLocation does not contain a file"); IDE_EXIT; } #ifdef IDE_ENABLE_TRACE { const gchar *path = ide_file_get_path (lookup.file); IDE_TRACE_MSG ("Locating %s, open_if_not_found=%d", path, open_if_not_found); } #endif ide_perspective_views_foreach (IDE_PERSPECTIVE (self), ide_editor_perspective_find_source_location, &lookup); if (!open_if_not_found && lookup.view == NULL) IDE_EXIT; if (lookup.view == NULL) { FocusLocation *state; IdeBufferManager *bufmgr; IdeWorkbench *workbench; IdeContext *context; workbench = ide_widget_get_workbench (GTK_WIDGET (self)); context = ide_workbench_get_context (workbench); bufmgr = ide_context_get_buffer_manager (context); state = g_slice_new0 (FocusLocation); state->self = g_object_ref (self); state->location = ide_source_location_ref (location); ide_buffer_manager_load_file_async (bufmgr, lookup.file, FALSE, IDE_WORKBENCH_OPEN_FLAGS_NONE, NULL, NULL, ide_editor_perspective_focus_location_cb, state); IDE_EXIT; } line = ide_source_location_get_line (location); line_offset = ide_source_location_get_line_offset (location); stack = gtk_widget_get_ancestor (GTK_WIDGET (lookup.view), IDE_TYPE_LAYOUT_STACK); ide_layout_stack_set_visible_child (IDE_LAYOUT_STACK (stack), IDE_LAYOUT_VIEW (lookup.view)); ide_editor_view_scroll_to_line_offset (lookup.view, line, line_offset); IDE_EXIT; }