~ubuntu-branches/ubuntu/wily/geany/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/20_load_plugins_from_all_paths.patch/src/plugins.c

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2013-05-10 15:27:35 UTC
  • mfrom: (4.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130510152735-bvm7jw5k95ahpp8q
Tags: 1.23+dfsg-2
* Upload to unstable, fixes FTBFS (Closes: #707368)
* [a472a80] Enable parallel builds
* [17a6378] No-change bump of Standards-Version to 3.9.4
* [ea78f31] Add README.source describing git branch structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
15
 *      GNU General Public License for more details.
16
16
 *
17
 
 *      You should have received a copy of the GNU General Public License
18
 
 *      along with this program; if not, write to the Free Software
19
 
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
 
 *      MA 02110-1301, USA.
 
17
 *      You should have received a copy of the GNU General Public License along
 
18
 *      with this program; if not, write to the Free Software Foundation, Inc.,
 
19
 *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
20
 */
22
21
 
23
22
/* Code to manage, load and unload plugins. */
883
882
        gchar *plugin_path_custom;
884
883
        gboolean ret = FALSE;
885
884
 
886
 
        plugin_path_config = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL);
 
885
        plugin_path_config = g_build_filename(app->configdir, "plugins", NULL);
887
886
        if (g_str_has_prefix(fname, plugin_path_config))
888
887
                ret = TRUE;
889
888
 
942
941
                if (tmp == NULL || utils_str_casecmp(tmp, "." G_MODULE_SUFFIX) != 0)
943
942
                        continue;
944
943
 
945
 
                fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL);
 
944
                fname = g_build_filename(path, item->data, NULL);
946
945
                if (plugin_new(fname, FALSE, TRUE))
947
946
                        count++;
948
947
                g_free(fname);
962
961
        gchar *path;
963
962
        gchar *install_dir = win32_get_installation_dir();
964
963
 
965
 
        path = g_strconcat(install_dir, "\\lib", NULL);
 
964
        path = g_build_filename(install_dir, "lib", NULL);
966
965
        g_free(install_dir);
967
966
 
968
967
        return path;
969
968
#else
970
 
        return g_strconcat(GEANY_LIBDIR, G_DIR_SEPARATOR_S "geany", NULL);
 
969
        return g_build_filename(GEANY_LIBDIR, "geany", NULL);
971
970
#endif
972
971
}
973
972
 
979
978
        gchar *plugin_path_system;
980
979
        gchar *plugin_path_custom;
981
980
 
982
 
        plugin_path_config = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL);
 
981
        plugin_path_config = g_build_filename(app->configdir, "plugins", NULL);
983
982
        plugin_path_system = get_plugin_path();
984
983
 
985
984
        /* first load plugins in ~/.config/geany/plugins/ */
1051
1050
}
1052
1051
 
1053
1052
 
 
1053
/* Update the global active plugins list so it's up-to-date when configuration
 
1054
 * is saved. Called in response to GeanyObject's "save-settings" signal. */
1054
1055
static void update_active_plugins_pref(void)
1055
1056
{
1056
1057
        gint i = 0;
1057
1058
        GList *list;
1058
 
        gsize count = g_list_length(active_plugin_list) + g_list_length(failed_plugins_list);
 
1059
        gsize count;
 
1060
 
 
1061
        /* if plugins are disabled, don't clear list of active plugins */
 
1062
        if (!want_plugins)
 
1063
                return;
 
1064
 
 
1065
        count = g_list_length(active_plugin_list) + g_list_length(failed_plugins_list);
1059
1066
 
1060
1067
        g_strfreev(active_plugins_pref);
1061
1068
 
1085
1092
}
1086
1093
 
1087
1094
 
1088
 
static void on_save_settings(GKeyFile *config)
1089
 
{
1090
 
        /* if plugins are disabled, don't clear list of active plugins */
1091
 
        if (want_plugins)
1092
 
                update_active_plugins_pref();
1093
 
}
1094
 
 
1095
 
 
1096
1095
/* called even if plugin support is disabled */
1097
1096
void plugins_init(void)
1098
1097
{
1111
1110
        stash_group_add_entry(group, &prefs.custom_plugin_path,
1112
1111
                "custom_plugin_path", "", "extra_plugin_path_entry");
1113
1112
 
1114
 
        g_signal_connect(geany_object, "save-settings", G_CALLBACK(on_save_settings), NULL);
 
1113
        g_signal_connect(geany_object, "save-settings", G_CALLBACK(update_active_plugins_pref), NULL);
1115
1114
        stash_group_add_string_vector(group, &active_plugins_pref, "active_plugins", NULL);
1116
1115
}
1117
1116
 
1375
1374
}
1376
1375
 
1377
1376
 
 
1377
/* Callback when plugin manager dialog closes, only ever has response of
 
1378
 * GTK_RESPONSE_OK or GTK_RESPONSE_DELETE_EVENT and both are treated the same. */
1378
1379
static void pm_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
1379
1380
{
1380
1381
        if (plugin_list != NULL)
1413
1414
 
1414
1415
        pm_widgets.dialog = gtk_dialog_new_with_buttons(_("Plugins"), GTK_WINDOW(main_widgets.window),
1415
1416
                                                GTK_DIALOG_DESTROY_WITH_PARENT,
1416
 
                                                GTK_STOCK_OK, GTK_RESPONSE_CANCEL, NULL);
 
1417
                                                GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
1417
1418
        vbox = ui_dialog_vbox_new(GTK_DIALOG(pm_widgets.dialog));
1418
1419
        gtk_widget_set_name(pm_widgets.dialog, "GeanyDialog");
1419
1420
        gtk_box_set_spacing(GTK_BOX(vbox), 6);
1483
1484
 
1484
1485
        g_signal_connect(pm_widgets.dialog, "response", G_CALLBACK(pm_dialog_response), NULL);
1485
1486
 
1486
 
        gtk_container_add(GTK_CONTAINER(vbox), vbox2);
 
1487
        gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
1487
1488
        gtk_widget_show_all(pm_widgets.dialog);
1488
1489
}
1489
1490