forked from community-ssu/rtcom-accounts-plugin-gtalk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
- Loading branch information
1 parent
6701f00
commit 80dc281
Showing
8 changed files
with
1,175 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> | ||
<!--Generated with glade3 3.4.5 on Mon Jan 26 15:30:07 2009 --> | ||
<glade-interface> | ||
<requires lib="rtcom-accounts-widgets"/> | ||
<requires lib="rtcom-hildon"/> | ||
<widget class="GtkDialog" id="register"> | ||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> | ||
<property name="border_width">5</property> | ||
<property name="resizable">False</property> | ||
<property name="modal">False</property> | ||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> | ||
<property name="destroy_with_parent">True</property> | ||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> | ||
<property name="has_separator">False</property> | ||
<child internal-child="vbox"> | ||
<widget class="GtkVBox" id="dialog-vbox1"> | ||
<property name="visible">True</property> | ||
<property name="spacing">2</property> | ||
<child> | ||
<widget class="RtcomPage" id="page"> | ||
<child> | ||
<widget class="GtkVBox" id="dialog-vbox2"> | ||
<property name="visible">True</property> | ||
<property name="spacing">2</property> | ||
<child> | ||
<widget class="GtkTable" id="table1"> | ||
<property name="visible">True</property> | ||
<property name="n_rows">3</property> | ||
<property name="n_columns">2</property> | ||
<property name="column-spacing">16</property> | ||
<property name="homogeneous">False</property> | ||
<child> | ||
<widget class="RtcomParamString" id="password2"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="max_length">64</property> | ||
<property name="msg_empty" translatable="yes">accounts_fi_enter_fields_first</property> | ||
<property name="required">True</property> | ||
<property name="can_next">False</property> | ||
<property name="name_change">True</property> | ||
<property name="hildon_input_mode">HILDON_GTK_INPUT_MODE_ALPHA | HILDON_GTK_INPUT_MODE_NUMERIC | HILDON_GTK_INPUT_MODE_SPECIAL | HILDON_GTK_INPUT_MODE_INVISIBLE</property> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">1</property> | ||
<property name="right_attach">2</property> | ||
<property name="top_attach">2</property> | ||
<property name="bottom_attach">3</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="RtcomParamString" id="password"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="max_length">64</property> | ||
<property name="field">password</property> | ||
<property name="msg_empty" translatable="yes">accounts_fi_enter_fields_first</property> | ||
<property name="required">True</property> | ||
<property name="can_next">False</property> | ||
<property name="name_change">True</property> | ||
<property name="hildon_input_mode">HILDON_GTK_INPUT_MODE_ALPHA | HILDON_GTK_INPUT_MODE_NUMERIC | HILDON_GTK_INPUT_MODE_SPECIAL | HILDON_GTK_INPUT_MODE_INVISIBLE</property> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">1</property> | ||
<property name="right_attach">2</property> | ||
<property name="top_attach">1</property> | ||
<property name="bottom_attach">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="RtcomParamString" id="username"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="field">account</property> | ||
<property name="invalid_chars_re">[:'"<>&;#\s]</property> | ||
<property name="required">True</property> | ||
<property name="can_next">False</property> | ||
<property name="can_default">True</property> | ||
<property name="name_change">True</property> | ||
<property name="msg_empty" translatable="yes">accounts_fi_enter_fields_first</property> | ||
<property name="hildon_input_mode">HILDON_GTK_INPUT_MODE_FULL</property> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">1</property> | ||
<property name="right_attach">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="GtkAlignment" id="align3"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0.0</property> | ||
<property name="left-padding">16</property> | ||
<child> | ||
<widget class="GtkLabel" id="label3"> | ||
<property name="visible">True</property> | ||
<property name="label" translatable="yes">accounts_fi_retype_password</property> | ||
<property name="xalign">0.0</property> | ||
</widget> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">0</property> | ||
<property name="right_attach">1</property> | ||
<property name="top_attach">2</property> | ||
<property name="bottom_attach">3</property> | ||
<property name="x-options">GTK_SHRINK | GTK_FILL</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="GtkAlignment" id="align2"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0.0</property> | ||
<property name="left-padding">16</property> | ||
<child> | ||
<widget class="GtkLabel" id="label2"> | ||
<property name="visible">True</property> | ||
<property name="label" translatable="yes">accounts_fi_password</property> | ||
<property name="xalign">0.0</property> | ||
</widget> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">0</property> | ||
<property name="right_attach">1</property> | ||
<property name="top_attach">1</property> | ||
<property name="bottom_attach">2</property> | ||
<property name="x-options">GTK_SHRINK | GTK_FILL</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="GtkAlignment" id="align1"> | ||
<property name="visible">True</property> | ||
<property name="xalign">0.0</property> | ||
<property name="left-padding">16</property> | ||
<child> | ||
<widget class="GtkLabel" id="label1"> | ||
<property name="visible">True</property> | ||
<property name="label" translatable="yes">accounts_fi_user_name_sip</property> | ||
<property name="xalign">0.0</property> | ||
</widget> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="left_attach">0</property> | ||
<property name="right_attach">1</property> | ||
<property name="x-options">GTK_SHRINK | GTK_FILL</property> | ||
</packing> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="expand">False</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<widget class="GtkAlignment" id="align4"> | ||
<child> | ||
<widget class="HildonButton" id="advanced-button-Button-finger"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="receives_default">True</property> | ||
<property name="label" translatable="yes">accounts_bd_advanced_settings</property> | ||
<property name="response_id">0</property> | ||
<property | ||
name="size">HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH</property> | ||
<property name="xalign">0.0</property> | ||
</widget> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="position">2</property> | ||
</packing> | ||
</child> | ||
</widget> | ||
</child> | ||
</widget> | ||
</child> | ||
<child internal-child="action_area"> | ||
<widget class="GtkHButtonBox" id="dialog-action_area1"> | ||
<property name="visible">True</property> | ||
<property name="layout_style">GTK_BUTTONBOX_END</property> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
</widget> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="pack_type">GTK_PACK_END</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</widget> | ||
</child> | ||
</widget> | ||
</glade-interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* advanced-page.h | ||
* | ||
* Copyright (C) 2022 Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> | ||
* | ||
* This library is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation. | ||
* | ||
* This library is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef __ADVANCED_PAGE_H_INCLUDED__ | ||
#define __ADVANCED_PAGE_H_INCLUDED__ | ||
|
||
static void | ||
set_widget_setting (gpointer key, gpointer value, gpointer userdata) | ||
{ | ||
GtkWidget *widget = key; | ||
|
||
if (RTCOM_IS_PARAM_INT(widget)) | ||
{ | ||
rtcom_param_int_set_value(RTCOM_PARAM_INT(widget), | ||
GPOINTER_TO_INT(value)); | ||
} | ||
else if (GTK_IS_ENTRY(widget)) | ||
gtk_entry_set_text(GTK_ENTRY(widget), value); | ||
else if (HILDON_IS_CHECK_BUTTON(widget)) | ||
{ | ||
hildon_check_button_set_active(HILDON_CHECK_BUTTON(widget), | ||
GPOINTER_TO_INT(value)); | ||
} | ||
else | ||
{ | ||
g_warning("%s: unhandled widget type %s (%s)", G_STRFUNC, | ||
g_type_name(G_TYPE_FROM_INSTANCE(widget)), | ||
gtk_widget_get_name(widget)); | ||
} | ||
} | ||
|
||
static void | ||
get_advanced_settings (GtkWidget *widget, GHashTable *advanced_settings) | ||
{ | ||
const gchar *name = gtk_widget_get_name(widget); | ||
|
||
if (RTCOM_IS_PARAM_INT(widget)) | ||
{ | ||
gint value = rtcom_param_int_get_value(RTCOM_PARAM_INT(widget)); | ||
g_hash_table_replace(advanced_settings, widget, | ||
GINT_TO_POINTER(value)); | ||
} | ||
else if (GTK_IS_ENTRY(widget)) | ||
{ | ||
gchar *data = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); | ||
g_object_set_data_full(G_OBJECT(widget), "adv_data", data, g_free); | ||
g_hash_table_replace(advanced_settings, widget, data); | ||
} | ||
else if (HILDON_IS_CHECK_BUTTON(widget)) | ||
{ | ||
gboolean active = | ||
hildon_check_button_get_active(HILDON_CHECK_BUTTON(widget)); | ||
|
||
g_hash_table_replace(advanced_settings, widget, GINT_TO_POINTER(active)); | ||
} | ||
else if (GTK_IS_CONTAINER(widget)) | ||
{ | ||
gtk_container_foreach(GTK_CONTAINER(widget), | ||
(GtkCallback)get_advanced_settings, | ||
advanced_settings); | ||
} | ||
else if (!GTK_IS_LABEL(widget)) | ||
{ | ||
g_warning("%s: unhandled widget type %s (%s)", G_STRFUNC, | ||
g_type_name(G_TYPE_FROM_INSTANCE(widget)), name); | ||
} | ||
} | ||
|
||
static void | ||
on_advanced_settings_response(GtkWidget *dialog, gint response, | ||
RtcomDialogContext *context) | ||
{ | ||
GHashTable *advanced_settings = | ||
g_object_get_data(G_OBJECT(context), "settings"); | ||
|
||
if (response == GTK_RESPONSE_OK) | ||
{ | ||
GError *error = NULL; | ||
GladeXML *xml = glade_get_widget_tree(dialog); | ||
GtkWidget *page = glade_xml_get_widget(xml, "page"); | ||
|
||
if (rtcom_page_validate(RTCOM_PAGE(page), &error)) | ||
{ | ||
get_advanced_settings(dialog, advanced_settings); | ||
gtk_widget_hide(dialog); | ||
} | ||
else | ||
{ | ||
g_warning("advanced page validation failed"); | ||
|
||
if (error) | ||
{ | ||
g_warning("%s: error \"%s\"", G_STRFUNC, error->message); | ||
hildon_banner_show_information(dialog, NULL, error->message); | ||
g_error_free(error); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
g_hash_table_foreach(advanced_settings, set_widget_setting, dialog); | ||
gtk_widget_hide(dialog); | ||
} | ||
} | ||
|
||
#endif /* __ADVANCED_PAGE_H_INCLUDED__ */ |
Oops, something went wrong.