|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* pluma-time-plugin.c
|
|
|
|
|
* xedit-time-plugin.c
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002-2005 - Paolo Maggi
|
|
|
|
|
*
|
|
|
|
@@ -21,8 +21,8 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
|
|
|
|
* list of people on the pluma Team.
|
|
|
|
|
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
|
|
|
|
* list of people on the xedit Team.
|
|
|
|
|
* See the ChangeLog files for a list of changes.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@@ -33,26 +33,26 @@
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#include "pluma-time-plugin.h"
|
|
|
|
|
#include <pluma/pluma-help.h>
|
|
|
|
|
#include "xedit-time-plugin.h"
|
|
|
|
|
#include <xedit/xedit-help.h>
|
|
|
|
|
|
|
|
|
|
#include <glib/gi18n-lib.h>
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gmodule.h>
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
|
|
|
|
|
#include <pluma/pluma-debug.h>
|
|
|
|
|
#include <pluma/pluma-utils.h>
|
|
|
|
|
#include <xedit/xedit-debug.h>
|
|
|
|
|
#include <xedit/xedit-utils.h>
|
|
|
|
|
|
|
|
|
|
#define PLUMA_TIME_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
|
|
|
|
PLUMA_TYPE_TIME_PLUGIN, \
|
|
|
|
|
PlumaTimePluginPrivate))
|
|
|
|
|
#define XEDIT_TIME_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
|
|
|
|
|
XEDIT_TYPE_TIME_PLUGIN, \
|
|
|
|
|
XeditTimePluginPrivate))
|
|
|
|
|
|
|
|
|
|
#define WINDOW_DATA_KEY "PlumaTimePluginWindowData"
|
|
|
|
|
#define WINDOW_DATA_KEY "XeditTimePluginWindowData"
|
|
|
|
|
#define MENU_PATH "/MenuBar/EditMenu/EditOps_4"
|
|
|
|
|
|
|
|
|
|
/* GSettings keys */
|
|
|
|
|
#define TIME_SCHEMA "org.mate.pluma.plugins.time"
|
|
|
|
|
#define TIME_SCHEMA "org.x.editor.plugins.time"
|
|
|
|
|
#define PROMPT_TYPE_KEY "prompt-type"
|
|
|
|
|
#define SELECTED_FORMAT_KEY "selected-format"
|
|
|
|
|
#define CUSTOM_FORMAT_KEY "custom-format"
|
|
|
|
@@ -119,7 +119,7 @@ struct _TimeConfigureDialog
|
|
|
|
|
GtkWidget *custom_format_example;
|
|
|
|
|
|
|
|
|
|
/* Info needed for the response handler */
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
XeditTimePlugin *plugin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct _ChooseFormatDialog ChooseFormatDialog;
|
|
|
|
@@ -139,7 +139,7 @@ struct _ChooseFormatDialog
|
|
|
|
|
|
|
|
|
|
/* Info needed for the response handler */
|
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
XeditTimePlugin *plugin;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
@@ -148,14 +148,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 */
|
|
|
|
|
} PlumaTimePluginPromptType;
|
|
|
|
|
} XeditTimePluginPromptType;
|
|
|
|
|
|
|
|
|
|
struct _PlumaTimePluginPrivate
|
|
|
|
|
struct _XeditTimePluginPrivate
|
|
|
|
|
{
|
|
|
|
|
GSettings *settings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PLUMA_PLUGIN_REGISTER_TYPE(PlumaTimePlugin, pluma_time_plugin)
|
|
|
|
|
XEDIT_PLUGIN_REGISTER_TYPE(XeditTimePlugin, xedit_time_plugin)
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
@@ -165,8 +165,8 @@ typedef struct
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
PlumaWindow *window;
|
|
|
|
|
PlumaTimePlugin *plugin;
|
|
|
|
|
XeditWindow *window;
|
|
|
|
|
XeditTimePlugin *plugin;
|
|
|
|
|
} ActionData;
|
|
|
|
|
|
|
|
|
|
static void time_cb (GtkAction *action, ActionData *data);
|
|
|
|
@@ -184,25 +184,25 @@ static const GtkActionEntry action_entries[] =
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pluma_time_plugin_init (PlumaTimePlugin *plugin)
|
|
|
|
|
xedit_time_plugin_init (XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin initializing");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "XeditTimePlugin initializing");
|
|
|
|
|
|
|
|
|
|
plugin->priv = PLUMA_TIME_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
plugin->priv = XEDIT_TIME_PLUGIN_GET_PRIVATE (plugin);
|
|
|
|
|
|
|
|
|
|
plugin->priv->settings = g_settings_new (TIME_SCHEMA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pluma_time_plugin_finalize (GObject *object)
|
|
|
|
|
xedit_time_plugin_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object);
|
|
|
|
|
XeditTimePlugin *plugin = XEDIT_TIME_PLUGIN (object);
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin finalizing");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "XeditTimePlugin finalizing");
|
|
|
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (plugin->priv->settings));
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (pluma_time_plugin_parent_class)->finalize (object);
|
|
|
|
|
G_OBJECT_CLASS (xedit_time_plugin_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -215,17 +215,17 @@ free_window_data (WindowData *data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
update_ui_real (PlumaWindow *window,
|
|
|
|
|
update_ui_real (XeditWindow *window,
|
|
|
|
|
WindowData *data)
|
|
|
|
|
{
|
|
|
|
|
PlumaView *view;
|
|
|
|
|
XeditView *view;
|
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
view = pluma_window_get_active_view (window);
|
|
|
|
|
view = xedit_window_get_active_view (window);
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "View: %p", view);
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "View: %p", view);
|
|
|
|
|
|
|
|
|
|
action = gtk_action_group_get_action (data->action_group,
|
|
|
|
|
"InsertDateAndTime");
|
|
|
|
@@ -235,24 +235,24 @@ update_ui_real (PlumaWindow *window,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_activate (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
impl_activate (XeditPlugin *plugin,
|
|
|
|
|
XeditWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GtkUIManager *manager;
|
|
|
|
|
WindowData *data;
|
|
|
|
|
ActionData *action_data;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
data = g_new (WindowData, 1);
|
|
|
|
|
action_data = g_new (ActionData, 1);
|
|
|
|
|
|
|
|
|
|
action_data->plugin = PLUMA_TIME_PLUGIN (plugin);
|
|
|
|
|
action_data->plugin = XEDIT_TIME_PLUGIN (plugin);
|
|
|
|
|
action_data->window = window;
|
|
|
|
|
|
|
|
|
|
manager = pluma_window_get_ui_manager (window);
|
|
|
|
|
manager = xedit_window_get_ui_manager (window);
|
|
|
|
|
|
|
|
|
|
data->action_group = gtk_action_group_new ("PlumaTimePluginActions");
|
|
|
|
|
data->action_group = gtk_action_group_new ("XeditTimePluginActions");
|
|
|
|
|
gtk_action_group_set_translation_domain (data->action_group,
|
|
|
|
|
GETTEXT_PACKAGE);
|
|
|
|
|
gtk_action_group_add_actions_full (data->action_group,
|
|
|
|
@@ -282,15 +282,15 @@ impl_activate (PlumaPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_deactivate (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
impl_deactivate (XeditPlugin *plugin,
|
|
|
|
|
XeditWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GtkUIManager *manager;
|
|
|
|
|
WindowData *data;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
manager = pluma_window_get_ui_manager (window);
|
|
|
|
|
manager = xedit_window_get_ui_manager (window);
|
|
|
|
|
|
|
|
|
|
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
|
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
@@ -302,12 +302,12 @@ impl_deactivate (PlumaPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
impl_update_ui (PlumaPlugin *plugin,
|
|
|
|
|
PlumaWindow *window)
|
|
|
|
|
impl_update_ui (XeditPlugin *plugin,
|
|
|
|
|
XeditWindow *window)
|
|
|
|
|
{
|
|
|
|
|
WindowData *data;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
|
|
|
|
g_return_if_fail (data != NULL);
|
|
|
|
@@ -316,10 +316,10 @@ impl_update_ui (PlumaPlugin *plugin,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* whether we should prompt the user or use the specified format */
|
|
|
|
|
static PlumaTimePluginPromptType
|
|
|
|
|
get_prompt_type (PlumaTimePlugin *plugin)
|
|
|
|
|
static XeditTimePluginPromptType
|
|
|
|
|
get_prompt_type (XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
PlumaTimePluginPromptType prompt_type;
|
|
|
|
|
XeditTimePluginPromptType prompt_type;
|
|
|
|
|
|
|
|
|
|
prompt_type = g_settings_get_enum (plugin->priv->settings,
|
|
|
|
|
PROMPT_TYPE_KEY);
|
|
|
|
@@ -328,8 +328,8 @@ get_prompt_type (PlumaTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_prompt_type (PlumaTimePlugin *plugin,
|
|
|
|
|
PlumaTimePluginPromptType prompt_type)
|
|
|
|
|
set_prompt_type (XeditTimePlugin *plugin,
|
|
|
|
|
XeditTimePluginPromptType prompt_type)
|
|
|
|
|
{
|
|
|
|
|
if (!g_settings_is_writable (plugin->priv->settings,
|
|
|
|
|
PROMPT_TYPE_KEY))
|
|
|
|
@@ -344,7 +344,7 @@ set_prompt_type (PlumaTimePlugin *plugin,
|
|
|
|
|
|
|
|
|
|
/* The selected format in the list */
|
|
|
|
|
static gchar *
|
|
|
|
|
get_selected_format (PlumaTimePlugin *plugin)
|
|
|
|
|
get_selected_format (XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gchar *sel_format;
|
|
|
|
|
|
|
|
|
@@ -355,7 +355,7 @@ get_selected_format (PlumaTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_selected_format (PlumaTimePlugin *plugin,
|
|
|
|
|
set_selected_format (XeditTimePlugin *plugin,
|
|
|
|
|
const gchar *format)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
@@ -373,7 +373,7 @@ set_selected_format (PlumaTimePlugin *plugin,
|
|
|
|
|
|
|
|
|
|
/* the custom format in the entry */
|
|
|
|
|
static gchar *
|
|
|
|
|
get_custom_format (PlumaTimePlugin *plugin)
|
|
|
|
|
get_custom_format (XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gchar *format;
|
|
|
|
|
|
|
|
|
@@ -384,7 +384,7 @@ get_custom_format (PlumaTimePlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_custom_format (PlumaTimePlugin *plugin,
|
|
|
|
|
set_custom_format (XeditTimePlugin *plugin,
|
|
|
|
|
const gchar *format)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
@@ -408,7 +408,7 @@ get_time (const gchar* format)
|
|
|
|
|
size_t out_length = 0;
|
|
|
|
|
gchar *locale_format;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (format != NULL, NULL);
|
|
|
|
|
|
|
|
|
@@ -450,24 +450,24 @@ get_time (const gchar* format)
|
|
|
|
|
static void
|
|
|
|
|
dialog_disposed (GObject *obj, gpointer dialog_pointer)
|
|
|
|
|
{
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_free (dialog_pointer);
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "END");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "END");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GtkTreeModel *
|
|
|
|
|
create_model (GtkWidget *listview,
|
|
|
|
|
const gchar *sel_format,
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
gint i = 0;
|
|
|
|
|
GtkListStore *store;
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
/* create list store */
|
|
|
|
|
store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
|
|
|
@@ -490,7 +490,7 @@ create_model (GtkWidget *listview,
|
|
|
|
|
|
|
|
|
|
str = get_time (formats[i]);
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "%d : %s", i, str);
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "%d : %s", i, str);
|
|
|
|
|
gtk_list_store_append (store, &iter);
|
|
|
|
|
gtk_list_store_set (store, &iter,
|
|
|
|
|
COLUMN_FORMATS, str,
|
|
|
|
@@ -521,7 +521,7 @@ scroll_to_selected (GtkTreeView *tree_view)
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (tree_view);
|
|
|
|
|
g_return_if_fail (model != NULL);
|
|
|
|
@@ -546,12 +546,12 @@ scroll_to_selected (GtkTreeView *tree_view)
|
|
|
|
|
static void
|
|
|
|
|
create_formats_list (GtkWidget *listview,
|
|
|
|
|
const gchar *sel_format,
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
|
GtkCellRenderer *cell;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (listview != NULL);
|
|
|
|
|
g_return_if_fail (sel_format != NULL);
|
|
|
|
@@ -585,7 +585,7 @@ updated_custom_format_example (GtkEntry *format_entry,
|
|
|
|
|
gchar *str;
|
|
|
|
|
gchar *escaped_time;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (format_entry));
|
|
|
|
|
g_return_if_fail (GTK_IS_LABEL (format_example));
|
|
|
|
@@ -608,7 +608,7 @@ static void
|
|
|
|
|
choose_format_dialog_button_toggled (GtkToggleButton *button,
|
|
|
|
|
ChooseFormatDialog *dialog)
|
|
|
|
|
{
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom)))
|
|
|
|
|
{
|
|
|
|
@@ -632,7 +632,7 @@ choose_format_dialog_button_toggled (GtkToggleButton *button,
|
|
|
|
|
static void
|
|
|
|
|
configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *dialog)
|
|
|
|
|
{
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom)))
|
|
|
|
|
{
|
|
|
|
@@ -669,7 +669,7 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
model = gtk_tree_view_get_model (GTK_TREE_VIEW (listview));
|
|
|
|
|
g_return_val_if_fail (model != NULL, 0);
|
|
|
|
@@ -683,7 +683,7 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter, COLUMN_INDEX, &selected_value, -1);
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Sel value: %d", selected_value);
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "Sel value: %d", selected_value);
|
|
|
|
|
|
|
|
|
|
return selected_value;
|
|
|
|
|
}
|
|
|
|
@@ -692,14 +692,14 @@ get_format_from_list (GtkWidget *listview)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static TimeConfigureDialog *
|
|
|
|
|
get_configure_dialog (PlumaTimePlugin *plugin)
|
|
|
|
|
get_configure_dialog (XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
TimeConfigureDialog *dialog = NULL;
|
|
|
|
|
gchar *data_dir;
|
|
|
|
|
gchar *ui_file;
|
|
|
|
|
GtkWidget *content;
|
|
|
|
|
GtkWidget *viewport;
|
|
|
|
|
PlumaTimePluginPromptType prompt_type;
|
|
|
|
|
XeditTimePluginPromptType prompt_type;
|
|
|
|
|
gchar *sf, *cf;
|
|
|
|
|
GtkWidget *error_widget;
|
|
|
|
|
gboolean ret;
|
|
|
|
@@ -708,7 +708,7 @@ get_configure_dialog (PlumaTimePlugin *plugin)
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
GtkWidget *dlg = gtk_dialog_new_with_buttons (_("Configure insert date/time plugin..."),
|
|
|
|
|
NULL,
|
|
|
|
@@ -735,9 +735,9 @@ get_configure_dialog (PlumaTimePlugin *plugin)
|
|
|
|
|
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
data_dir = xedit_plugin_get_data_dir (XEDIT_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "xedit-time-setup-dialog.ui", NULL);
|
|
|
|
|
ret = xedit_utils_get_ui_objects (ui_file,
|
|
|
|
|
root_objects,
|
|
|
|
|
&error_widget,
|
|
|
|
|
"time_dialog_content", &content,
|
|
|
|
@@ -844,7 +844,7 @@ static void
|
|
|
|
|
real_insert_time (GtkTextBuffer *buffer,
|
|
|
|
|
const gchar *the_time)
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Insert: %s", the_time);
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "Insert: %s", the_time);
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_begin_user_action (buffer);
|
|
|
|
|
|
|
|
|
@@ -878,8 +878,8 @@ choose_format_dialog_row_activated (GtkTreeView *list,
|
|
|
|
|
|
|
|
|
|
static ChooseFormatDialog *
|
|
|
|
|
get_choose_format_dialog (GtkWindow *parent,
|
|
|
|
|
PlumaTimePluginPromptType prompt_type,
|
|
|
|
|
PlumaTimePlugin *plugin)
|
|
|
|
|
XeditTimePluginPromptType prompt_type,
|
|
|
|
|
XeditTimePlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
ChooseFormatDialog *dialog;
|
|
|
|
|
gchar *data_dir;
|
|
|
|
@@ -894,9 +894,9 @@ get_choose_format_dialog (GtkWindow *parent,
|
|
|
|
|
|
|
|
|
|
dialog = g_new0 (ChooseFormatDialog, 1);
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
data_dir = xedit_plugin_get_data_dir (XEDIT_PLUGIN (plugin));
|
|
|
|
|
ui_file = g_build_filename (data_dir, "xedit-time-dialog.ui", NULL);
|
|
|
|
|
ret = xedit_utils_get_ui_objects (ui_file,
|
|
|
|
|
NULL,
|
|
|
|
|
&error_widget,
|
|
|
|
|
"choose_format_dialog", &dialog->dialog,
|
|
|
|
@@ -1017,17 +1017,17 @@ choose_format_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
{
|
|
|
|
|
case GTK_RESPONSE_HELP:
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
pluma_help_display (GTK_WINDOW (widget),
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
xedit_help_display (GTK_WINDOW (widget),
|
|
|
|
|
NULL,
|
|
|
|
|
"pluma-insert-date-time-plugin");
|
|
|
|
|
"xedit-insert-date-time-plugin");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
|
{
|
|
|
|
|
gchar *the_time;
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
xedit_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)))
|
|
|
|
@@ -1060,7 +1060,7 @@ choose_format_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
gtk_widget_destroy (dialog->dialog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1071,11 +1071,11 @@ time_cb (GtkAction *action,
|
|
|
|
|
{
|
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
gchar *the_time = NULL;
|
|
|
|
|
PlumaTimePluginPromptType prompt_type;
|
|
|
|
|
XeditTimePluginPromptType prompt_type;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (data->window));
|
|
|
|
|
buffer = GTK_TEXT_BUFFER (xedit_window_get_active_document (data->window));
|
|
|
|
|
g_return_if_fail (buffer != NULL);
|
|
|
|
|
|
|
|
|
|
prompt_type = get_prompt_type (data->plugin);
|
|
|
|
@@ -1128,7 +1128,7 @@ ok_button_pressed (TimeConfigureDialog *dialog)
|
|
|
|
|
gint sel_format;
|
|
|
|
|
const gchar *custom_format;
|
|
|
|
|
|
|
|
|
|
pluma_debug (DEBUG_PLUGINS);
|
|
|
|
|
xedit_debug (DEBUG_PLUGINS);
|
|
|
|
|
|
|
|
|
|
sel_format = get_format_from_list (dialog->list);
|
|
|
|
|
|
|
|
|
@@ -1150,7 +1150,7 @@ ok_button_pressed (TimeConfigureDialog *dialog)
|
|
|
|
|
set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format);
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -1162,16 +1162,16 @@ configure_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
{
|
|
|
|
|
case GTK_RESPONSE_HELP:
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
|
|
|
|
|
|
|
|
|
|
pluma_help_display (GTK_WINDOW (widget),
|
|
|
|
|
xedit_help_display (GTK_WINDOW (widget),
|
|
|
|
|
NULL,
|
|
|
|
|
"pluma-insert-date-time-plugin#pluma-date-time-configure");
|
|
|
|
|
"xedit-insert-date-time-plugin#xedit-date-time-configure");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
|
|
|
|
|
|
|
|
|
|
ok_button_pressed (dialog);
|
|
|
|
|
|
|
|
|
@@ -1180,20 +1180,20 @@ configure_dialog_response_cb (GtkWidget *widget,
|
|
|
|
|
}
|
|
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
|
{
|
|
|
|
|
pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
xedit_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
|
|
|
|
|
gtk_widget_destroy (dialog->dialog);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
|
impl_create_configure_dialog (PlumaPlugin *plugin)
|
|
|
|
|
impl_create_configure_dialog (XeditPlugin *plugin)
|
|
|
|
|
{
|
|
|
|
|
TimeConfigureDialog *dialog;
|
|
|
|
|
|
|
|
|
|
dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (plugin));
|
|
|
|
|
dialog = get_configure_dialog (XEDIT_TIME_PLUGIN (plugin));
|
|
|
|
|
|
|
|
|
|
dialog->plugin = PLUMA_TIME_PLUGIN (plugin);
|
|
|
|
|
dialog->plugin = XEDIT_TIME_PLUGIN (plugin);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (dialog->dialog,
|
|
|
|
|
"response",
|
|
|
|
@@ -1204,12 +1204,12 @@ impl_create_configure_dialog (PlumaPlugin *plugin)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pluma_time_plugin_class_init (PlumaTimePluginClass *klass)
|
|
|
|
|
xedit_time_plugin_class_init (XeditTimePluginClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
|
|
|
|
|
XeditPluginClass *plugin_class = XEDIT_PLUGIN_CLASS (klass);
|
|
|
|
|
|
|
|
|
|
object_class->finalize = pluma_time_plugin_finalize;
|
|
|
|
|
object_class->finalize = xedit_time_plugin_finalize;
|
|
|
|
|
|
|
|
|
|
plugin_class->activate = impl_activate;
|
|
|
|
|
plugin_class->deactivate = impl_deactivate;
|
|
|
|
@@ -1217,5 +1217,5 @@ pluma_time_plugin_class_init (PlumaTimePluginClass *klass)
|
|
|
|
|
|
|
|
|
|
plugin_class->create_configure_dialog = impl_create_configure_dialog;
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate));
|
|
|
|
|
g_type_class_add_private (object_class, sizeof (XeditTimePluginPrivate));
|
|
|
|
|
}
|