30static gboolean app_block_termination_cb(GtkosxApplication *
app, gpointer data)
40static gboolean open_project_idle(gchar *locale_path)
54static gboolean app_open_file_cb(GtkosxApplication *osx_app, gchar *path, gpointer user_data)
61 if (!g_path_is_absolute(locale_path))
63 gchar *cwd = g_get_current_dir();
64 SETPTR(locale_path, g_build_filename(cwd, locale_path,
NULL));
68 if (g_str_has_suffix(path,
".geany"))
70 g_idle_add((GSourceFunc)open_project_idle, locale_path);
83static void on_new_window(GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
91 GtkWidget *item, *menu;
92 GtkosxApplication *osx_app = gtkosx_application_get();
95 gtk_widget_hide(item);
96 gtkosx_application_set_menu_bar(osx_app, GTK_MENU_SHELL(item));
99 gtk_widget_hide(item);
102 gtkosx_application_insert_app_menu_item(osx_app, item, 0);
105 gtkosx_application_set_help_menu(osx_app, GTK_MENU_ITEM(item));
107 gtkosx_application_set_use_quartz_accelerators(osx_app, FALSE);
109 g_signal_connect(osx_app,
"NSApplicationBlockTermination",
110 G_CALLBACK(app_block_termination_cb),
NULL);
111 g_signal_connect(osx_app,
"NSApplicationOpenFile",
112 G_CALLBACK(app_open_file_cb),
NULL);
114 menu = gtk_menu_new();
115 item = gtk_menu_item_new_with_label(
"New Window");
116 g_signal_connect(G_OBJECT(item),
"activate", G_CALLBACK(on_new_window),
NULL);
117 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
118 gtkosx_application_set_dock_menu(osx_app, GTK_MENU_SHELL(menu));
GeanyDocument * document_open_file(const gchar *locale_filename, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens a document specified by locale_filename.
Main program-related commands.
gboolean project_load_file_with_session(const gchar *locale_file_name)
gboolean project_ask_close(void)
struct GeanyProject * project
Currently active project or NULL if none is open.
GtkWidget * window
Main window.
gchar * file_name
Where the project file is stored (in UTF-8).
GeanyMainWidgets main_widgets
GtkWidget * ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
Returns a widget from a name in a component, usually created by Glade.
User Interface general utility functions.
gchar * utils_get_utf8_from_locale(const gchar *locale_text)
Converts the given string (in locale encoding) into UTF-8 encoding.
void utils_start_new_geany_instance(const gchar *doc_path)
gchar * utils_get_locale_from_utf8(const gchar *utf8_text)
Converts the given UTF-8 encoded string into locale encoding.
General utility functions, non-GTK related.
#define SETPTR(ptr, result)
Assigns result to ptr, then frees the old value.