xed-completion-plugin.c: Clean up the code style

This commit is contained in:
JosephMcc 2020-09-08 23:03:00 -07:00 committed by Michael Webster
parent 3bf1b62a34
commit 4dcfaada50
1 changed files with 30 additions and 32 deletions

View File

@ -50,7 +50,7 @@ struct _XedWordCompletionPluginPrivate
GtkWidget *window; GtkWidget *window;
XedView *view; XedView *view;
GtkSourceCompletionProvider *provider; GtkSourceCompletionProvider *provider;
GSettings *settings; GSettings *settings;
}; };
enum enum
@ -135,9 +135,9 @@ xed_wordcompletion_plugin_dispose (GObject *object)
static void static void
xed_wordcompletion_plugin_set_property (GObject *object, xed_wordcompletion_plugin_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
XedWordCompletionPlugin *plugin = XED_WORDCOMPLETION_PLUGIN (object); XedWordCompletionPlugin *plugin = XED_WORDCOMPLETION_PLUGIN (object);
@ -216,16 +216,16 @@ create_provider (void)
settings = g_settings_new (WORDCOMPLETION_SETTINGS_BASE); settings = g_settings_new (WORDCOMPLETION_SETTINGS_BASE);
g_settings_bind (settings, SETTINGS_KEY_MINIMUM_WORD_SIZE, g_settings_bind (settings, SETTINGS_KEY_MINIMUM_WORD_SIZE,
provider, "minimum-word-size", provider, "minimum-word-size",
G_SETTINGS_BIND_GET); G_SETTINGS_BIND_GET);
update_activation (provider, settings); update_activation (provider, settings);
g_signal_connect_object (settings, g_signal_connect_object (settings,
"changed::" SETTINGS_KEY_INTERACTIVE_COMPLETION, "changed::" SETTINGS_KEY_INTERACTIVE_COMPLETION,
G_CALLBACK (on_interactive_completion_changed_cb), G_CALLBACK (on_interactive_completion_changed_cb),
provider, provider,
0); 0);
g_object_unref (settings); g_object_unref (settings);
@ -293,8 +293,7 @@ xed_wordcompletion_view_activate (XedViewActivatable *activatable)
priv->provider = g_object_ref (provider); priv->provider = g_object_ref (provider);
gtk_source_completion_add_provider (completion, provider, NULL); gtk_source_completion_add_provider (completion, provider, NULL);
gtk_source_completion_words_register (GTK_SOURCE_COMPLETION_WORDS (provider), gtk_source_completion_words_register (GTK_SOURCE_COMPLETION_WORDS (provider), buf);
buf);
} }
static void static void
@ -315,14 +314,13 @@ xed_wordcompletion_view_deactivate (XedViewActivatable *activatable)
priv->provider, priv->provider,
NULL); NULL);
gtk_source_completion_words_unregister (GTK_SOURCE_COMPLETION_WORDS (priv->provider), gtk_source_completion_words_unregister (GTK_SOURCE_COMPLETION_WORDS (priv->provider), buf);
buf);
} }
static void static void
dialog_response_cb (GtkWidget *widget, dialog_response_cb (GtkWidget *widget,
gint response, gint response,
gpointer data) gpointer data)
{ {
gtk_widget_destroy (widget); gtk_widget_destroy (widget);
} }
@ -358,37 +356,37 @@ get_configure_widget (XedWordCompletionPlugin *plugin)
data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin)); data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "xed-wordcompletion-configure.ui", NULL); ui_file = g_build_filename (data_dir, "xed-wordcompletion-configure.ui", NULL);
ret = xed_utils_get_ui_objects (ui_file, ret = xed_utils_get_ui_objects (ui_file,
NULL, NULL,
&error_widget, &error_widget,
"configure_dialog", &widget->dialog, "configure_dialog", &widget->dialog,
"spin_button_min_word_size", &widget->min_word_size, "spin_button_min_word_size", &widget->min_word_size,
"check_button_interactive_completion", &widget->interactive_completion, "check_button_interactive_completion", &widget->interactive_completion,
NULL); NULL);
g_free (data_dir); g_free (data_dir);
g_free (ui_file); g_free (ui_file);
if (!ret) if (!ret)
{ {
return NULL; return NULL;
} }
gtk_window_set_modal (GTK_WINDOW (widget->dialog), TRUE); gtk_window_set_modal (GTK_WINDOW (widget->dialog), TRUE);
g_settings_bind (widget->settings, SETTINGS_KEY_INTERACTIVE_COMPLETION, g_settings_bind (widget->settings, SETTINGS_KEY_INTERACTIVE_COMPLETION,
widget->interactive_completion, "active", widget->interactive_completion, "active",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES); G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
g_settings_bind (widget->settings, SETTINGS_KEY_MINIMUM_WORD_SIZE, g_settings_bind (widget->settings, SETTINGS_KEY_MINIMUM_WORD_SIZE,
widget->min_word_size, "value", widget->min_word_size, "value",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES); G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_GET_NO_CHANGES);
g_signal_connect (widget->dialog, "destroy", g_signal_connect (widget->dialog, "destroy",
G_CALLBACK (configure_widget_destroyed), widget); G_CALLBACK (configure_widget_destroyed), widget);
gtk_widget_show (GTK_WIDGET (widget->dialog)); gtk_widget_show (GTK_WIDGET (widget->dialog));
g_signal_connect (widget->dialog, "response", g_signal_connect (widget->dialog, "response",
G_CALLBACK (dialog_response_cb), widget); G_CALLBACK (dialog_response_cb), widget);
return widget; return widget;
} }