|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* gedit-time-plugin.c
|
|
|
|
|
* pluma-time-plugin.c
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002-2005 - Paolo Maggi
|
|
|
|
|
*
|
|
|
|
@@ -21,8 +21,8 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Modified by the gedit Team, 2002. See the AUTHORS file for a
|
|
|
|
|
* list of people on the gedit Team.
|
|
|
|
|
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
|
|
|
|
* list of people on the pluma Team.
|
|
|
|
|
* See the ChangeLog files for a list of changes.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@@ -35,25 +35,25 @@
|
|
|
|
|
|
|
|
|
|
#include <mateconf/mateconf-client.h>
|
|
|
|
|
|
|
|
|
|
#include "gedit-time-plugin.h"
|
|
|
|
|
#include <gedit/gedit-help.h>
|
|
|
|
|
#include "pluma-time-plugin.h"
|
|
|
|
|
#include <pluma/pluma-help.h>
|
|
|
|
|
|
|
|
|
|
#include <glib/gi18n-lib.h>
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gmodule.h>
|
|
|
|
|
|
|
|
|
|
#include <gedit/gedit-debug.h>
|
|
|
|
|
#include <gedit/gedit-utils.h>
|
|
|
|
|
#include <pluma/pluma-debug.h>
|
|
|
|
|
#include <pluma/pluma-utils.h>
|
|
|
|
|
|
|
|
|
|
#define GEDIT_TIME_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
|
|
|
|
GEDIT_TYPE_TIME_PLUGIN, \
|
|
|
|
|
GeditTimePluginPrivate))
|
|
|
|
|
#define PLUMA_TIME_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
|
|
|
|
PLUMA_TYPE_TIME_PLUGIN, \
|
|
|
|
|
PlumaTimePluginPrivate))
|
|
|
|
|
|
|
|
|
|
#define WINDOW_DATA_KEY "GeditTimePluginWindowData"
|
|
|
|
|
#define WINDOW_DATA_KEY "PlumaTimePluginWindowData"
|
|
|
|
|
#define MENU_PATH "/MenuBar/EditMenu/EditOps_4"
|
|
|
|
|
|
|
|
|
|
/* mateconf keys */
|
|
|
|
|
#define TIME_BASE_KEY "/apps/gedit-2/plugins/time"
|
|
|
|
|
#define TIME_BASE_KEY "/apps/pluma-2/plugins/time"
|
|
|
|
|
#define PROMPT_TYPE_KEY TIME_BASE_KEY "/prompt_type"
|
|
|
|
|
#define SELECTED_FORMAT_KEY TIME_BASE_KEY "/selected_format"
|
|
|
|
|
#define CUSTOM_FORMAT_KEY TIME_BASE_KEY "/custom_format"
|
|
|
|
@@ -122,7 +122,7 @@ struct _TimeConfigureDialog
|
|
|
|
|
GtkWidget *custom_format_example;
|
|
|
|
|
|
|
|
|
|
/* Info needed for the response handler */
|
|
|
|
|
GeditTimePlugin *plugin;
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct _ChooseFormatDialog ChooseFormatDialog;
|
|
|
|
@@ -142,7 +142,7 @@ struct _ChooseFormatDialog
|
|
|
|
|
|
|
|
|
|
/* Info needed for the response handler */
|
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
GeditTimePlugin *plugin;
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
@@ -151,14 +151,14 @@ typedef enum
|
|
|
|
|
PROMPT_CUSTOM_FORMAT, /* Popup dialog with entry preselected */
|
|
|
|
|
USE_SELECTED_FORMAT, /* Use selected format directly */
|
|
|
|
|
USE_CUSTOM_FORMAT /* Use custom format directly */
|
|
|
|
|
} GeditTimePluginPromptType;
|
|
|
|
|
} PlumaTimePluginPromptType;
|
|
|
|
|
|
|
|
|
|
struct _GeditTimePluginPrivate
|
|
|
|
|
struct _PlumaTimePluginPrivate
|
|
|
|
|
{
|
|
|
|
|
MateConfClient *mateconf_client;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GEDIT_PLUGIN_REGISTER_TYPE(GeditTimePlugin, gedit_time_plugin)
|
|
|
|
|
PLUMA_PLUGIN_REGISTER_TYPE(PlumaTimePlugin, pluma_time_plugin)
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
@@ -168,8 +168,8 @@ typedef struct
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GeditWindow *window;
|
|
|
|
|
GeditTimePlugin *plugin;
|
|
|
|
|
PlumaWindow *window;
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
} ActionData;
|
|
|
|
|
|
|
|
|
|
static void time_cb (GtkAction *action, ActionData *data);
|
|
|
|
@@ -187,11 +187,11 @@ static const GtkActionEntry action_entries[] =
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gedit_time_plugin_init (GeditTimePlugin *plugin)
|
|
|
|
|
pluma_time_plugin_init (PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GeditTimePlugin initializing");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin initializing");
|
|
|
|
|
|
|
|
|
|
plugin->priv = GEDIT_TIME_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
plugin->priv = PLUMA_TIME_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
|
|
|
|
|
plugin->priv->mateconf_client = mateconf_client_get_default ();
|
|
|
|
|
|
|
|
|
@@ -202,17 +202,17 @@ gedit_time_plugin_init (GeditTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gedit_time_plugin_finalize (GObject *object)
|
|
|
|
|
pluma_time_plugin_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GeditTimePlugin *plugin = GEDIT_TIME_PLUGIN (object);
|
|
|
|
|
PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object);
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GeditTimePlugin finalizing");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin finalizing");
|
|
|
|
|
|
|
|
|
|
mateconf_client_suggest_sync (plugin->priv->mateconf_client, NULL);
|
|
|
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (plugin->priv->mateconf_client));
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gedit_time_plugin_parent_class)->finalize (object);
|
|
|
|
|
G_OBJECT_CLASS (pluma_time_plugin_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -225,17 +225,17 @@ free_window_data (WindowData *data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
update_ui_real (GeditWindow *window,
|
|
|
|
|
update_ui_real (PlumaWindow *window,
|
|
|
|
|
WindowData *data)
|
|
|
|
|
{
|
|
|
|
|
GeditView *view;
|
|
|
|
|
PlumaView *view;
|
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
view = gedit_window_get_active_view (window);
|
|
|
|
|
view = pluma_window_get_active_view (window);
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "View: %p", view);
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "View: %p", view);
|
|
|
|
|
|
|
|
|
|
action = gtk_action_group_get_action (data->action_group,
|
|
|
|
|
"InsertDateAndTime");
|
|
|
|
@@ -245,24 +245,24 @@ update_ui_real (GeditWindow *window,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_activate (GeditPlugin *plugin,
|
|
|
|
|
GeditWindow *window)
|
|
|
|
|
impl_activate (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GtkUIManager *manager;
|
|
|
|
|
WindowData *data;
|
|
|
|
|
ActionData *action_data;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
data = g_new (WindowData, 1);
|
|
|
|
|
action_data = g_new (ActionData, 1);
|
|
|
|
|
|
|
|
|
|
action_data->plugin = GEDIT_TIME_PLUGIN (plugin);
|
|
|
|
|
action_data->plugin = PLUMA_TIME_PLUGIN (plugin);
|
|
|
|
|
action_data->window = window;
|
|
|
|
|
|
|
|
|
|
manager = gedit_window_get_ui_manager (window);
|
|
|
|
|
manager = pluma_window_get_ui_manager (window);
|
|
|
|
|
|
|
|
|
|
data->action_group = gtk_action_group_new ("GeditTimePluginActions");
|
|
|
|
|
data->action_group = gtk_action_group_new ("PlumaTimePluginActions");
|
|
|
|
|
gtk_action_group_set_translation_domain (data->action_group,
|
|
|
|
|
GETTEXT_PACKAGE);
|
|
|
|
|
gtk_action_group_add_actions_full (data->action_group,
|
|
|
|
@@ -292,15 +292,15 @@ impl_activate (GeditPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_deactivate (GeditPlugin *plugin,
|
|
|
|
|
GeditWindow *window)
|
|
|
|
|
impl_deactivate (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GtkUIManager *manager;
|
|
|
|
|
WindowData *data;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
manager = gedit_window_get_ui_manager (window);
|
|
|
|
|
manager = pluma_window_get_ui_manager (window);
|
|
|
|
|
|
|
|
|
|
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
|
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
@@ -312,12 +312,12 @@ impl_deactivate (GeditPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_update_ui (GeditPlugin *plugin,
|
|
|
|
|
GeditWindow *window)
|
|
|
|
|
impl_update_ui (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
{
|
|
|
|
|
WindowData *data;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
|
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
@@ -326,11 +326,11 @@ impl_update_ui (GeditPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* whether we should prompt the user or use the specified format */
|
|
|
|
|
static GeditTimePluginPromptType
|
|
|
|
|
get_prompt_type (GeditTimePlugin *plugin)
|
|
|
|
|
static PlumaTimePluginPromptType
|
|
|
|
|
get_prompt_type (PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gchar *prompt_type;
|
|
|
|
|
GeditTimePluginPromptType res;
|
|
|
|
|
PlumaTimePluginPromptType res;
|
|
|
|
|
|
|
|
|
|
prompt_type = mateconf_client_get_string (plugin->priv->mateconf_client,
|
|
|
|
|
PROMPT_TYPE_KEY,
|
|
|
|
@@ -354,8 +354,8 @@ get_prompt_type (GeditTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_prompt_type (GeditTimePlugin *plugin,
|
|
|
|
|
GeditTimePluginPromptType prompt_type)
|
|
|
|
|
set_prompt_type (PlumaTimePlugin *plugin,
|
|
|
|
|
PlumaTimePluginPromptType prompt_type)
|
|
|
|
|
{
|
|
|
|
|
const gchar * str;
|
|
|
|
|
|
|
|
|
@@ -389,7 +389,7 @@ set_prompt_type (GeditTimePlugin *plugin,
|
|
|
|
|
|
|
|
|
|
/* The selected format in the list */
|
|
|
|
|
static gchar *
|
|
|
|
|
get_selected_format (GeditTimePlugin *plugin)
|
|
|
|
|
get_selected_format (PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gchar *sel_format;
|
|
|
|
|
|
|
|
|
@@ -401,7 +401,7 @@ get_selected_format (GeditTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_selected_format (GeditTimePlugin *plugin,
|
|
|
|
|
set_selected_format (PlumaTimePlugin *plugin,
|
|
|
|
|
const gchar *format)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
@@ -421,7 +421,7 @@ set_selected_format (GeditTimePlugin *plugin,
|
|
|
|
|
|
|
|
|
|
/* the custom format in the entry */
|
|
|
|
|
static gchar *
|
|
|
|
|
get_custom_format (GeditTimePlugin *plugin)
|
|
|
|
|
get_custom_format (PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gchar *format;
|
|
|
|
|
|
|
|
|
@@ -433,7 +433,7 @@ get_custom_format (GeditTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_custom_format (GeditTimePlugin *plugin,
|
|
|
|
|
set_custom_format (PlumaTimePlugin *plugin,
|
|
|
|
|
const gchar *format)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
@@ -459,7 +459,7 @@ get_time (const gchar* format)
|
|
|
|
|
size_t out_length = 0;
|
|
|
|
|
gchar *locale_format;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (format != NULL, NULL);
|
|
|
|
|
|
|
|
|
@@ -501,24 +501,24 @@ get_time (const gchar* format)
|
|
|
|
|
static void
|
|
|
|
|
dialog_destroyed (GtkObject *obj, gpointer dialog_pointer)
|
|
|
|
|
{
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_free (dialog_pointer);
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "END");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "END");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GtkTreeModel *
|
|
|
|
|
create_model (GtkWidget *listview,
|
|
|
|
|
const gchar *sel_format,
|
|
|
|
|
GeditTimePlugin *plugin)
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gint i = 0;
|
|
|
|
|
GtkListStore *store;
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
/* create list store */
|
|
|
|
|
store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
|
|
|
@@ -541,7 +541,7 @@ create_model (GtkWidget *listview,
|
|
|
|
|
|
|
|
|
|
str = get_time (formats[i]);
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "%d : %s", i, str);
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "%d : %s", i, str);
|
|
|
|
|
gtk_list_store_append (store, &iter);
|
|
|
|
|
gtk_list_store_set (store, &iter,
|
|
|
|
|
COLUMN_FORMATS, str,
|
|
|
|
@@ -572,7 +572,7 @@ scroll_to_selected (GtkTreeView *tree_view)
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (tree_view);
|
|
|
|
|
g_return_if_fail (model != NULL);
|
|
|
|
@@ -597,12 +597,12 @@ scroll_to_selected (GtkTreeView *tree_view)
|
|
|
|
|
static void
|
|
|
|
|
create_formats_list (GtkWidget *listview,
|
|
|
|
|
const gchar *sel_format,
|
|
|
|
|
GeditTimePlugin *plugin)
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
|
GtkCellRenderer *cell;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (listview != NULL);
|
|
|
|
|
g_return_if_fail (sel_format != NULL);
|
|
|
|
@@ -636,7 +636,7 @@ updated_custom_format_example (GtkEntry *format_entry,
|
|
|
|
|
gchar *str;
|
|
|
|
|
gchar *escaped_time;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (format_entry));
|
|
|
|
|
g_return_if_fail (GTK_IS_LABEL (format_example));
|
|
|
|
@@ -659,7 +659,7 @@ static void
|
|
|
|
|
choose_format_dialog_button_toggled (GtkToggleButton *button,
|
|
|
|
|
ChooseFormatDialog *dialog)
|
|
|
|
|
{
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom)))
|
|
|
|
|
{
|
|
|
|
@@ -683,7 +683,7 @@ choose_format_dialog_button_toggled (GtkToggleButton *button,
|
|
|
|
|
static void
|
|
|
|
|
configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *dialog)
|
|
|
|
|
{
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom)))
|
|
|
|
|
{
|
|
|
|
@@ -720,7 +720,7 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (listview));
|
|
|
|
|
g_return_val_if_fail (model != NULL, 0);
|
|
|
|
@@ -734,7 +734,7 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter, COLUMN_INDEX, &selected_value, -1);
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "Sel value: %d", selected_value);
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Sel value: %d", selected_value);
|
|
|
|
|
|
|
|
|
|
return selected_value;
|
|
|
|
|
}
|
|
|
|
@@ -743,14 +743,14 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static TimeConfigureDialog *
|
|
|
|
|
get_configure_dialog (GeditTimePlugin *plugin)
|
|
|
|
|
get_configure_dialog (PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
TimeConfigureDialog *dialog = NULL;
|
|
|
|
|
gchar *data_dir;
|
|
|
|
|
gchar *ui_file;
|
|
|
|
|
GtkWidget *content;
|
|
|
|
|
GtkWidget *viewport;
|
|
|
|
|
GeditTimePluginPromptType prompt_type;
|
|
|
|
|
PlumaTimePluginPromptType prompt_type;
|
|
|
|
|
gchar *sf, *cf;
|
|
|
|
|
GtkWidget *error_widget;
|
|
|
|
|
gboolean ret;
|
|
|
|
@@ -759,7 +759,7 @@ get_configure_dialog (GeditTimePlugin *plugin)
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
dialog = g_new0 (TimeConfigureDialog, 1);
|
|
|
|
|
|
|
|
|
@@ -784,9 +784,9 @@ get_configure_dialog (GeditTimePlugin *plugin)
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (dialog->dialog != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
data_dir = gedit_plugin_get_data_dir (GEDIT_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "gedit-time-setup-dialog.ui", NULL);
|
|
|
|
|
ret = gedit_utils_get_ui_objects (ui_file,
|
|
|
|
|
data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "pluma-time-setup-dialog.ui", NULL);
|
|
|
|
|
ret = pluma_utils_get_ui_objects (ui_file,
|
|
|
|
|
root_objects,
|
|
|
|
|
&error_widget,
|
|
|
|
|
"time_dialog_content", &content,
|
|
|
|
@@ -894,7 +894,7 @@ static void
|
|
|
|
|
real_insert_time (GtkTextBuffer *buffer,
|
|
|
|
|
const gchar *the_time)
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "Insert: %s", the_time);
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Insert: %s", the_time);
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_begin_user_action (buffer);
|
|
|
|
|
|
|
|
|
@@ -928,8 +928,8 @@ choose_format_dialog_row_activated (GtkTreeView *list,
|
|
|
|
|
|
|
|
|
|
static ChooseFormatDialog *
|
|
|
|
|
get_choose_format_dialog (GtkWindow *parent,
|
|
|
|
|
GeditTimePluginPromptType prompt_type,
|
|
|
|
|
GeditTimePlugin *plugin)
|
|
|
|
|
PlumaTimePluginPromptType prompt_type,
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
ChooseFormatDialog *dialog;
|
|
|
|
|
gchar *data_dir;
|
|
|
|
@@ -944,9 +944,9 @@ get_choose_format_dialog (GtkWindow *parent,
|
|
|
|
|
|
|
|
|
|
dialog = g_new0 (ChooseFormatDialog, 1);
|
|
|
|
|
|
|
|
|
|
data_dir = gedit_plugin_get_data_dir (GEDIT_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "gedit-time-dialog.ui", NULL);
|
|
|
|
|
ret = gedit_utils_get_ui_objects (ui_file,
|
|
|
|
|
data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "pluma-time-dialog.ui", NULL);
|
|
|
|
|
ret = pluma_utils_get_ui_objects (ui_file,
|
|
|
|
|
NULL,
|
|
|
|
|
&error_widget,
|
|
|
|
|
"choose_format_dialog", &dialog->dialog,
|
|
|
|
@@ -1068,17 +1068,17 @@ choose_format_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
{
|
|
|
|
|
case GTK_RESPONSE_HELP:
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
gedit_help_display (GTK_WINDOW (widget),
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
pluma_help_display (GTK_WINDOW (widget),
|
|
|
|
|
NULL,
|
|
|
|
|
"gedit-insert-date-time-plugin");
|
|
|
|
|
"pluma-insert-date-time-plugin");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
|
{
|
|
|
|
|
gchar *the_time;
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
|
|
|
|
|
/* Get the user's chosen format */
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->use_list)))
|
|
|
|
@@ -1111,7 +1111,7 @@ choose_format_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
gtk_widget_destroy (dialog->dialog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1122,11 +1122,11 @@ time_cb (GtkAction *action,
|
|
|
|
|
{
|
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
gchar *the_time = NULL;
|
|
|
|
|
GeditTimePluginPromptType prompt_type;
|
|
|
|
|
PlumaTimePluginPromptType prompt_type;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
buffer = GTK_TEXT_BUFFER (gedit_window_get_active_document (data->window));
|
|
|
|
|
buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (data->window));
|
|
|
|
|
g_return_if_fail (buffer != NULL);
|
|
|
|
|
|
|
|
|
|
prompt_type = get_prompt_type (data->plugin);
|
|
|
|
@@ -1179,7 +1179,7 @@ ok_button_pressed (TimeConfigureDialog *dialog)
|
|
|
|
|
gint sel_format;
|
|
|
|
|
const gchar *custom_format;
|
|
|
|
|
|
|
|
|
|
gedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
sel_format = get_format_from_list (dialog->list);
|
|
|
|
|
|
|
|
|
@@ -1201,7 +1201,7 @@ ok_button_pressed (TimeConfigureDialog *dialog)
|
|
|
|
|
set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format);
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -1213,16 +1213,16 @@ configure_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
{
|
|
|
|
|
case GTK_RESPONSE_HELP:
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
|
|
|
|
|
gedit_help_display (GTK_WINDOW (dialog),
|
|
|
|
|
pluma_help_display (GTK_WINDOW (dialog),
|
|
|
|
|
NULL,
|
|
|
|
|
"gedit-date-time-configure");
|
|
|
|
|
"pluma-date-time-configure");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
|
|
|
|
|
ok_button_pressed (dialog);
|
|
|
|
|
|
|
|
|
@@ -1231,20 +1231,20 @@ configure_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
|
{
|
|
|
|
|
gedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
gtk_widget_destroy (dialog->dialog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
|
impl_create_configure_dialog (GeditPlugin *plugin)
|
|
|
|
|
impl_create_configure_dialog (PlumaPlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
TimeConfigureDialog *dialog;
|
|
|
|
|
|
|
|
|
|
dialog = get_configure_dialog (GEDIT_TIME_PLUGIN (plugin));
|
|
|
|
|
dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (plugin));
|
|
|
|
|
|
|
|
|
|
dialog->plugin = GEDIT_TIME_PLUGIN (plugin);
|
|
|
|
|
dialog->plugin = PLUMA_TIME_PLUGIN (plugin);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (dialog->dialog,
|
|
|
|
|
"response",
|
|
|
|
@@ -1255,12 +1255,12 @@ impl_create_configure_dialog (GeditPlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gedit_time_plugin_class_init (GeditTimePluginClass *klass)
|
|
|
|
|
pluma_time_plugin_class_init (PlumaTimePluginClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
GeditPluginClass *plugin_class = GEDIT_PLUGIN_CLASS (klass);
|
|
|
|
|
PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
|
|
|
|
|
|
|
|
|
|
object_class->finalize = gedit_time_plugin_finalize;
|
|
|
|
|
object_class->finalize = pluma_time_plugin_finalize;
|
|
|
|
|
|
|
|
|
|
plugin_class->activate = impl_activate;
|
|
|
|
|
plugin_class->deactivate = impl_deactivate;
|
|
|
|
@@ -1268,5 +1268,5 @@ gedit_time_plugin_class_init (GeditTimePluginClass *klass)
|
|
|
|
|
|
|
|
|
|
plugin_class->create_configure_dialog = impl_create_configure_dialog;
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (object_class, sizeof (GeditTimePluginPrivate));
|
|
|
|
|
g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate));
|
|
|
|
|
}
|