Example #1
0
static void
on_notify_prefs_default (GSettings* settings,
                         const gchar* key,
                         gpointer user_data)
{
	TerminalPlugin *tp = ANJUTA_PLUGIN_TERMINAL (user_data);
	preferences_changed (settings, tp);
}
Example #2
0
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
	TerminalPlugin *term_plugin;
	static gboolean initialized = FALSE;
	AnjutaUI *ui;
	
	DEBUG_PRINT ("%s", "TerminalPlugin: Activating Terminal plugin ...");
	
	term_plugin = ANJUTA_PLUGIN_TERMINAL (plugin);
	term_plugin->widget_added_to_shell = FALSE;
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	term_plugin->action_group = anjuta_ui_add_action_group_entries (ui,
										"ActionGroupTerminal",
										_("terminal operations"),
										actions_terminal,
										G_N_ELEMENTS (actions_terminal),
										GETTEXT_PACKAGE, TRUE, term_plugin);
	term_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
	
	terminal_create (term_plugin);
	
	if (!initialized)
	{
		register_stock_icons (plugin);
	}
	
	/* Setup prefs callbacks */
	prefs_init (term_plugin);
	
	/* Added widget in shell */
	anjuta_shell_add_widget (plugin->shell, term_plugin->frame,
							 "AnjutaTerminal", _("Terminal"),
							 "terminal-plugin-icon",
							 ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL);
	/* terminal_focus_cb (term_plugin->term, NULL, term_plugin); */
	term_plugin->widget_added_to_shell = TRUE;
	initialized = TRUE;

	/* Set all terminal preferences, at that time the terminal widget is
	 * not realized, a few vte functions are not working. Another
	 * possibility could be to call this when the widget is realized */
	preferences_changed (term_plugin->settings, term_plugin);
	
	/* set up project directory watch */
	term_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
														  IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
														  on_project_root_added,
														  0, NULL);
	
	return TRUE;
}
Example #3
0
void pref_init() {
    g_assert(!pref_file);
    pref_file = g_key_file_new();
    gchar* path = g_strconcat(g_get_user_config_dir(), "/", pref_filename, NULL);

    // Read preference file from path.
    if (g_key_file_load_from_file(pref_file, path, G_KEY_FILE_KEEP_COMMENTS, NULL)) {
        g_message("Loaded preferences from %s", path);
    }
    g_free(path);

    // Parse and set the colors from gaotrayrc "Colors" section.
    for (PrefColor* c = pref_colors; c < pref_colors + G_N_ELEMENTS(pref_colors); c++) {
        gchar* value = g_key_file_get_string(pref_file, "Colors", c->description, NULL);
        if (!value) {
            gdk_color_parse(c->preset, c->color);
        } else {
            gdk_color_parse(value, c->color);
            g_free(value);
        }
    }

    // Load the transparency option from gatotrayrc "Options" section.
    GError* gerror = NULL;
    gboolean transparency = g_key_file_get_boolean(pref_file, "Options", "Transparent Background", &gerror);
    if (!gerror) {
        pref_transparent = transparency;
    }

    // Load the command option from gatotrayrc "Options" section.
    gchar* value = g_key_file_get_string(pref_file, "Options", "Launch Command", NULL);
    // If we got a value for the command option then set it.
    if (value) {
        pref_command = g_strndup(value, 255);
    }
    preferences_changed();
}
Example #4
0
void on_command_changed(GtkEntry *entry) {
    pref_command = g_strdup(gtk_entry_get_text(entry));
    preferences_changed();
}
Example #5
0
// Called when the transparency option is changed.
void on_transparency_toggled(GtkToggleButton *togglebutton) {
    pref_transparent = gtk_toggle_button_get_active(togglebutton);
    preferences_changed();
}