Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r1657 - in
trunk/src/target/OM-2007/applications/openmoko-contacts: . po src
([EMAIL PROTECTED])
2. r1658 - in trunk/src/target/OM-2007/openmoko-libs: .
libmokoui ([EMAIL PROTECTED])
3. r1659 -
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0
([EMAIL PROTECTED])
4. r1660 - in trunk/src/target/OM-2007/openmoko-libs: .
libmokoui ([EMAIL PROTECTED])
--- Begin Message ---
Author: thomas
Date: 2007-04-04 19:42:01 +0200 (Wed, 04 Apr 2007)
New Revision: 1657
Modified:
trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-contacts/po/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-contacts/po/POTFILES.in
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
Log:
* src/contacts-contact-pane.c: (set_type), (get_type),
(compare_types), (set_type_cb), (field_button_add_cb),
(field_button_remove_cb), (make_widget): Save VCARD specification type
parameters. Partly fixes Bug 400.
Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
2007-04-04 09:31:16 UTC (rev 1656)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
2007-04-04 17:42:01 UTC (rev 1657)
@@ -1,3 +1,10 @@
+2007-04-04 Thomas Wood <[EMAIL PROTECTED]>
+
+ * src/contacts-contact-pane.c: (set_type), (get_type),
+ (compare_types), (set_type_cb), (field_button_add_cb),
+ (field_button_remove_cb), (make_widget): Save VCARD specification type
+ parameters. Partly fixes Bug 400.
+
2007-03-26 Thomas Wood <[EMAIL PROTECTED]>
* src/contacts-omoko.c: (create_main_window): Use correct icons on
Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/po/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/po/ChangeLog
2007-04-04 09:31:16 UTC (rev 1656)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/po/ChangeLog
2007-04-04 17:42:01 UTC (rev 1657)
@@ -1,3 +1,9 @@
+2007-04-04 Thomas Wood <[EMAIL PROTECTED]>
+
+ reviewed by: <delete if not using a buddy>
+
+ * POTFILES.in:
+
2007-03-07 Thomas Wood <[EMAIL PROTECTED]>
reviewed by: <delete if not using a buddy>
Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/po/POTFILES.in
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/po/POTFILES.in
2007-04-04 09:31:16 UTC (rev 1656)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/po/POTFILES.in
2007-04-04 17:42:01 UTC (rev 1657)
@@ -1,6 +1,5 @@
data/contacts.desktop.in
src/contacts-callbacks-ui.c
-src/contacts-edit-pane.c
src/contacts-main.c
src/contacts-utils.c
-src/contacts-gtk.c
+src/contacts-omoko.c
Modified:
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
2007-04-04 09:31:16 UTC (rev 1656)
+++
trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
2007-04-04 17:42:01 UTC (rev 1657)
@@ -39,21 +39,25 @@
GtkSizeGroup *size_group; /* used to sizing the labels */
};
-static gchar *email_types[] = {
- "Work",
- "Home",
- "Other",
- NULL
+typedef struct {
+ char *display;
+ char *vcard;
+} VCardTypes;
+
+static VCardTypes email_types[] = {
+ { "Work", "WORK"},
+ { "Home", "HOME" },
+ { "Other", "OTHER" },
+ {}
};
-static gchar *phone_types[] = {
- "Work",
- "Home",
- "Mobile",
- "Fax",
- "Pager",
- "Other",
- NULL
+static VCardTypes phone_types[] = {
+ { "Work", "VOICE;WORK"},
+ { "Home", "VOICE;HOME" },
+ { "Mobile", "CELL" },
+ { "Fax", "FAX" },
+ { "Other", "OTHER" },
+ {}
};
typedef struct {
@@ -62,7 +66,7 @@
char *icon; /* Icon name for the menu */
gboolean unique; /* If there can be only one of this field */
char *format; /* format string */
- gchar **types;
+ VCardTypes *types;
/* TODO: add an extra changed callback so that N handler can update FN, etc
*/
} FieldInfo;
@@ -241,16 +245,18 @@
GList *params;
EVCardAttributeParam *p = NULL;
-
+ /* look for the TYPE parameter */
for (params = e_vcard_attribute_get_params (attr); params;
params = g_list_next (params))
+ {
if (!strcmp (e_vcard_attribute_param_get_name (params->data), "TYPE"))
{
p = params->data;
break;
}
+ }
- /* if we didn't find the type param */
+ /* if we didn't find the TYPE parameter, so create it now */
if (p == NULL)
{
p = e_vcard_attribute_param_new ("TYPE");
@@ -259,32 +265,126 @@
/* FIXME: we can only deal with one attribute type value at the moment */
e_vcard_attribute_param_remove_values (p);
- e_vcard_attribute_param_add_value (p, type);
+
+ gint i;
+ gchar **values = g_strsplit (type, ";", -1);
+
+ for (i = 0; (values[i]); i++)
+ {
+ e_vcard_attribute_param_add_value (p, values[i]);
+ }
+
+ g_strfreev (values);
}
/*
* Convenience function to get the type property of a vcard attribute
+ * Returns the
*/
static gchar*
get_type (EVCardAttribute *attr)
{
- GList *list;
+ GList *list, *l;
+ gchar *result = NULL;
list = e_vcard_attribute_get_param (attr, "TYPE");
- /* FIXME: we can only deal with one attribute type value at the moment */
- return (list) ? list->data : NULL;
+
+ for (l = list; l; l = g_list_next (l))
+ {
+ if (result)
+ {
+ gchar *old_result = result;
+ result = g_strconcat (l->data, ";", old_result, NULL);
+ g_free (old_result);
+ }
+ else
+ {
+ result = g_strdup (l->data);
+ }
+ }
+
+ return result;
}
+/* returns whether b is a subset of a, where a and b are semi-colon seperated
+ * lists
+ */
+static gboolean
+compare_types (gchar *a, gchar *b)
+{
+ gchar **alist, **blist;
+ gboolean result = FALSE;
+ int i, j;
+
+ /* make sure a and b are not NULL */
+ if (!(a && b))
+ return FALSE;
+
+ alist = g_strsplit (a, ";", -1);
+ blist = g_strsplit (b, ";", -1);
+
+ /* check each element of blist exists in alist */
+ for (i = 0; blist[i]; i++)
+ {
+ gboolean exists = FALSE;
+ for (j = 0; alist[j]; j++)
+ {
+ if (!strcmp (alist[j], blist[i]))
+ {
+ exists = TRUE;
+ break;
+ }
+ }
+ /* if any of the items from b don't exist in a, we return false */
+ if (!exists)
+ {
+ result = FALSE;
+ break;
+ }
+ else
+ {
+ result = TRUE;
+ }
+ }
+
+ g_strfreev (alist);
+ g_strfreev (blist);
+
+ return result;
+}
+
/*
* Callback for when a menuitem in the attribute type menu is activated
*/
static void
set_type_cb (GtkWidget *widget, EVCardAttribute *attr)
{
+ int i;
+ gchar *vcard_type = NULL;
+ GtkWidget *box;
+ FieldInfo *info;
+
/* TODO: use quarks here */
- gchar *new_type = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+ gchar *display_type = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
ContactsContactPane *pane = g_object_get_data (G_OBJECT (widget),
"contact-pane");
- set_type (attr, new_type);
+ box = widget->parent;
+ if (!GTK_IS_HBOX (box))
+ return;
+
+ info = g_object_get_qdata (G_OBJECT (box), field_quark);
+
+
+ for (i = 0; &(info->types[i]); i++)
+ {
+ /* search the types array */
+ if (!strcmp (info->types[i].display, display_type))
+ {
+ vcard_type = info->types[i].vcard;
+ break;
+ }
+ }
+
+ set_type (attr, vcard_type);
pane->priv->dirty = TRUE;
}
@@ -297,6 +397,7 @@
GValue *v;
gint p;
+ /* widget path is: hbox.alignment.button*/
box = button->parent->parent;
if (!GTK_IS_HBOX (box))
return;
@@ -373,8 +474,11 @@
type = get_type (attr);
+
if (type == NULL && info->types != NULL)
- type = info->types[0];
+ {
+ type = info->types[0].vcard;
+ }
/* insert add/remove buttons */
if (pane->priv->editable && !info->unique)
@@ -400,8 +504,26 @@
/* The label (if required) */
- if (!info->unique && !pane->priv->editable) {
- s = g_strdup_printf ("%s:", type);
+ if (!info->unique && !pane->priv->editable && type)
+ {
+ s = NULL;
+
+ /* find the display name for the type */
+ for (i = 0; info->types[i].display; i++)
+ {
+ if (compare_types (type, info->types[i].vcard))
+ {
+ s = g_strdup_printf ("%s:", info->types[i].display);
+ break;
+ }
+ }
+
+ if (!s)
+ {
+ s = g_strdup_printf ("%s:", type);
+ }
+
+
type_label = gtk_label_new (s);
gtk_widget_set_name (type_label, "fieldlabel");
if (pane->priv->size_group)
@@ -417,15 +539,20 @@
combo = gtk_combo_box_new_text ();
gtk_widget_set_size_request (combo, -1, 46);
i = 0;
- for (s = info->types[i]; (s = info->types[i]); i++) {
+
+ /* add items to the types drop down (Home, Work, etc) */
+ for (s = info->types[i].display; (s = info->types[i].display); i++) {
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), s);
- if (!strcmp (s, type)) {
+
+ /* if the vcard type matches the current type, then select it */
+ if (compare_types (type, info->types[i].vcard)) {
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
is_custom_type = FALSE;
}
}
+
+ /* this type isn't in our list of types, so add it now as a custom entry */
if (is_custom_type) {
- /* type isn't in our list of types, so add it now */
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), type);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
}
--- End Message ---
--- Begin Message ---
Author: rob
Date: 2007-04-05 10:04:05 +0200 (Thu, 05 Apr 2007)
New Revision: 1658
Modified:
trunk/src/target/OM-2007/openmoko-libs/ChangeLog
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-dialog.c
Log:
2007-04-05 Rob Bradford <[EMAIL PROTECTED]>
* libmokoui/moko-dialog.c: (moko_dialog_init):
Remove close button. It isn't on the mockups.
Modified: trunk/src/target/OM-2007/openmoko-libs/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-04 17:42:01 UTC
(rev 1657)
+++ trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-05 08:04:05 UTC
(rev 1658)
@@ -1,3 +1,8 @@
+2007-04-05 Rob Bradford <[EMAIL PROTECTED]>
+
+ * libmokoui/moko-dialog.c: (moko_dialog_init):
+ Remove close button. It isn't on the mockups.
+
2007-04-03 Rob Bradford <[EMAIL PROTECTED]>
* libmokoui/moko-dialog.c: (moko_dialog_add_button),
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-dialog.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-dialog.c
2007-04-04 17:42:01 UTC (rev 1657)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-dialog.c
2007-04-05 08:04:05 UTC (rev 1658)
@@ -131,14 +131,6 @@
}
static void
-moko_dialog_closebutton_cb (GtkButton *button, gpointer user_data)
-{
- MokoDialog *self = MOKO_DIALOG (user_data);
-
- moko_dialog_response (self, GTK_RESPONSE_DELETE_EVENT);
-}
-
-static void
moko_dialog_init (MokoDialog *self)
{
MokoDialogPrivate* priv = DIALOG_PRIVATE(self);
@@ -152,7 +144,7 @@
*/
/* The primary vbox holds the contents of the dialog and the action_area */
- self->vbox = gtk_vbox_new (FALSE, 0);
+ self->vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (self), self->vbox);
/* Create the hbox at the top */
@@ -160,25 +152,18 @@
/* Add an eventbox to said hbox */
priv->eventbox = gtk_event_box_new ();
- gtk_box_pack_start (GTK_BOX(priv->hbox), priv->eventbox, TRUE, TRUE, 0);
- gtk_widget_set_name( priv->eventbox, "mokodialogwindow-title-labelbox" );
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->eventbox, TRUE, TRUE, 0);
+ gtk_widget_set_name (priv->eventbox, "mokodialogwindow-title-labelbox");
/* Create the label for the top */
- priv->label = gtk_label_new(NULL);
+ priv->label = gtk_label_new (NULL);
gtk_widget_set_name (priv->label, "mokodialogwindow-title-label");
/* Add to the eventbox */
- gtk_container_add (GTK_CONTAINER(priv->eventbox), priv->label);
+ gtk_container_add (GTK_CONTAINER (priv->eventbox), priv->label);
- /* Add close button */
- priv->closebutton = moko_pixmap_button_new ();
- g_signal_connect (G_OBJECT(priv->closebutton), "clicked",
G_CALLBACK(moko_dialog_closebutton_cb), self);
- gtk_widget_set_name(priv->closebutton, "mokodialogwindow-closebutton");
-
- gtk_box_pack_start (GTK_BOX(priv->hbox), priv->closebutton, FALSE, FALSE, 0);
-
/* Add this hbox to the start of vbox */
- gtk_box_pack_start (GTK_BOX (self->vbox), priv->hbox, FALSE, FALSE, 0 );
+ gtk_box_pack_start (GTK_BOX (self->vbox), priv->hbox, FALSE, FALSE, 0);
/**
* Now get back to the proper parts of the dialog
--- End Message ---
--- Begin Message ---
Author: rob
Date: 2007-04-05 10:13:06 +0200 (Thu, 05 Apr 2007)
New Revision: 1659
Added:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokomessagedialog
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-message-dialog-background.png
Modified:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
Log:
Add (temporary) background image for the MokoMessageDialog and the appropriate
them framework for using it.
Modified:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
2007-04-05 08:04:05 UTC (rev 1658)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
2007-04-05 08:13:06 UTC (rev 1659)
@@ -126,3 +126,5 @@
include "contactspane"
include "openmoko-today"
+
+include "mokomessagedialog"
Added:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokomessagedialog
===================================================================
---
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokomessagedialog
2007-04-05 08:04:05 UTC (rev 1658)
+++
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokomessagedialog
2007-04-05 08:13:06 UTC (rev 1659)
@@ -0,0 +1,6 @@
+style "moko-message-dialog"
+{
+ bg_pixmap[NORMAL] = "openmoko-message-dialog-background.png"
+}
+class "MokoMessageDialog" style "moko-message-dialog"
+
Added:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-message-dialog-background.png
===================================================================
(Binary files differ)
Property changes on:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-message-dialog-background.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
--- End Message ---
--- Begin Message ---
Author: rob
Date: 2007-04-05 10:26:52 +0200 (Thu, 05 Apr 2007)
New Revision: 1660
Added:
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.h
Modified:
trunk/src/target/OM-2007/openmoko-libs/ChangeLog
trunk/src/target/OM-2007/openmoko-libs/configure.ac
trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
Log:
2007-04-05 Rob Bradford <[EMAIL PROTECTED]>
* configure.ac:
Need to use gdk-pixbuf pkg-config file.
* libmokoui/Makefile.am:
* libmokoui/moko-message-dialog.c:
(moko_message_dialog_get_property),
(moko_message_dialog_set_property), (moko_message_dialog_dispose),
(moko_message_dialog_finalize), (moko_message_dialog_class_init),
(moko_message_dialog_shape_window),
(moko_message_dialog_realize_cb), (moko_message_dialog_init),
(moko_message_dialog_set_message),
(moko_message_dialog_set_image_from_stock),
(moko_message_dialog_new):
* libmokoui/moko-message-dialog.h:
First pass at a MokoMessageDialog.
Modified: trunk/src/target/OM-2007/openmoko-libs/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-05 08:13:06 UTC
(rev 1659)
+++ trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-05 08:26:52 UTC
(rev 1660)
@@ -1,5 +1,23 @@
2007-04-05 Rob Bradford <[EMAIL PROTECTED]>
+ * configure.ac:
+ Need to use gdk-pixbuf pkg-config file.
+
+ * libmokoui/Makefile.am:
+ * libmokoui/moko-message-dialog.c:
+ (moko_message_dialog_get_property),
+ (moko_message_dialog_set_property), (moko_message_dialog_dispose),
+ (moko_message_dialog_finalize), (moko_message_dialog_class_init),
+ (moko_message_dialog_shape_window),
+ (moko_message_dialog_realize_cb), (moko_message_dialog_init),
+ (moko_message_dialog_set_message),
+ (moko_message_dialog_set_image_from_stock),
+ (moko_message_dialog_new):
+ * libmokoui/moko-message-dialog.h:
+ First pass at a MokoMessageDialog.
+
+2007-04-05 Rob Bradford <[EMAIL PROTECTED]>
+
* libmokoui/moko-dialog.c: (moko_dialog_init):
Remove close button. It isn't on the mockups.
Modified: trunk/src/target/OM-2007/openmoko-libs/configure.ac
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/configure.ac 2007-04-05 08:13:06 UTC
(rev 1659)
+++ trunk/src/target/OM-2007/openmoko-libs/configure.ac 2007-04-05 08:26:52 UTC
(rev 1660)
@@ -16,7 +16,8 @@
# base deps
PKG_CHECK_MODULES(DEPS,
gtk+-2.0 >= $GTK_VERSION
- libecal-1.2 >= $LIBECAL_VERSION)
+ libecal-1.2 >= $LIBECAL_VERSION
+ gdk-pixbuf-2.0)
LIBS="$LIBS $DEPS_LIBS"
CFLAGS="$CFLAGS $DEPS_CFLAGS"
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
2007-04-05 08:13:06 UTC (rev 1659)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
2007-04-05 08:26:52 UTC (rev 1660)
@@ -16,7 +16,8 @@
moko-tool-box.h \
moko-tree-view.h \
moko-window.h \
- moko-dialog.h
+ moko-dialog.h \
+ moko-message-dialog.h
source_c = \
moko-alignment.c \
@@ -36,7 +37,8 @@
moko-tree-view.c \
moko-tool-box.c \
moko-window.c \
- moko-dialog.c
+ moko-dialog.c \
+ moko-message-dialog.c
DATADIR=$(datadir)
Added: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.c
2007-04-05 08:13:06 UTC (rev 1659)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.c
2007-04-05 08:26:52 UTC (rev 1660)
@@ -0,0 +1,237 @@
+/* moko-dialog.c
+ *
+ * Authored (in part) by Rob Bradford <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2007 OpenMoko Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program 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 Public License for more details.
+ *
+ * Also contains code directly derived from GTK+ (gtk/gtkdialog.c) with the
+ * following Copyright notice:
+ *
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ *
+ * Derivation Copyright (C) 2007 OpenMoko Inc.
+ * Derivation Authored by Rob Bradford <[EMAIL PROTECTED]
+ */
+
+#include "moko-message-dialog.h"
+#include <gtk/gtk.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+G_DEFINE_TYPE (MokoMessageDialog, moko_message_dialog, GTK_TYPE_DIALOG)
+
+#define MESSAGE_DIALOG_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_MESSAGE_DIALOG,
MokoMessageDialogPrivate))
+
+typedef struct _MokoMessageDialogPrivate MokoMessageDialogPrivate;
+
+struct _MokoMessageDialogPrivate
+{
+ gchar *message;
+ GtkWidget *label;
+ GtkWidget *image;
+ GtkWidget *image_alignment;
+ gboolean window_shaped;
+};
+
+static void
+moko_message_dialog_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+moko_message_dialog_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+moko_message_dialog_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (moko_message_dialog_parent_class)->dispose)
+ G_OBJECT_CLASS (moko_message_dialog_parent_class)->dispose (object);
+}
+
+static void
+moko_message_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (moko_message_dialog_parent_class)->finalize (object);
+}
+
+static void
+moko_message_dialog_class_init (MokoMessageDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (MokoMessageDialogPrivate));
+
+ object_class->get_property = moko_message_dialog_get_property;
+ object_class->set_property = moko_message_dialog_set_property;
+ object_class->dispose = moko_message_dialog_dispose;
+ object_class->finalize = moko_message_dialog_finalize;
+}
+
+static void
+moko_message_dialog_shape_window (GtkWidget *widget)
+{
+ GtkRcStyle *rc_style;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+ GdkBitmap *mask;
+
+ MokoMessageDialogPrivate* priv = MESSAGE_DIALOG_PRIVATE (widget);
+
+ rc_style = widget->style->rc_style;
+
+ pixbuf = gdk_pixbuf_new_from_file
(rc_style->bg_pixmap_name[GTK_STATE_NORMAL], &error);
+
+ if (pixbuf == NULL)
+ {
+ g_warning ("Error loading background pixbuf: %s", error->message);
+ g_clear_error (&error);
+ return;
+ }
+
+ mask = gdk_pixmap_new (NULL, gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf), 1);
+ gdk_pixbuf_render_threshold_alpha (pixbuf, mask, 0, 0, 0, 0, -1, -1, 100);
+
+ g_object_unref (pixbuf);
+
+ gdk_window_shape_combine_mask (widget->window, mask, 0, 0);
+
+ g_object_unref (mask);
+
+ priv->window_shaped = TRUE;
+}
+
+static void
+moko_message_dialog_realize_cb (GtkWidget *widget, gpointer user_data)
+{
+ MokoMessageDialogPrivate* priv = MESSAGE_DIALOG_PRIVATE (widget);
+
+ if (!priv->window_shaped)
+ moko_message_dialog_shape_window (widget);
+
+}
+
+static void
+moko_message_dialog_init (MokoMessageDialog *self)
+{
+ MokoMessageDialogPrivate* priv = MESSAGE_DIALOG_PRIVATE(self);
+ GtkWidget *vbox;
+ GtkWidget *label;
+ GtkWidget *alignment;
+ GtkWidget *image_alignment;
+
+ priv->message = NULL;
+
+ vbox = gtk_vbox_new (FALSE, 6);
+
+ alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+ image_alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
+
+ gtk_container_add (GTK_CONTAINER (alignment), vbox);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG (self)->vbox), alignment, TRUE, TRUE,
6);
+
+ gtk_button_box_set_layout (GTK_BUTTON_BOX(GTK_DIALOG (self)->action_area),
GTK_BUTTONBOX_SPREAD);
+
+ label = gtk_label_new (NULL);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+
+ gtk_misc_set_padding (GTK_MISC (label), 12, 12);
+
+ gtk_widget_set_size_request (GTK_WIDGET (label), 300, -1);
+
+ gtk_box_pack_end (GTK_BOX (vbox), label, TRUE, FALSE, 6);
+
+ gtk_widget_show_all (GTK_WIDGET (GTK_DIALOG (self)->vbox));
+
+ gtk_window_set_modal (GTK_WINDOW (self), TRUE);
+
+ gtk_box_pack_start (GTK_BOX (vbox), image_alignment, TRUE, TRUE, 6);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+
+ gtk_widget_set_size_request (GTK_WIDGET (self), 320, 480);
+ gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
+ gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+
+ g_signal_connect (self, "realize", G_CALLBACK
(moko_message_dialog_realize_cb), NULL);
+
+ priv->image_alignment = image_alignment;
+ priv->label = label;
+}
+
+void
+moko_message_dialog_set_message (MokoMessageDialog *dialog, const gchar
*new_message)
+{
+ MokoMessageDialogPrivate* priv = MESSAGE_DIALOG_PRIVATE(dialog);
+
+ g_free (priv->message);
+
+ priv->message = g_strdup (new_message);
+
+ gtk_label_set (GTK_LABEL (priv->label), priv->message);
+}
+
+void
+moko_message_dialog_set_image_from_stock (MokoMessageDialog *dialog, const
gchar *stock_id)
+{
+ MokoMessageDialogPrivate* priv = MESSAGE_DIALOG_PRIVATE(dialog);
+ GtkWidget *old_image = priv->image;
+
+ priv->image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_DIALOG);
+
+ if (old_image != NULL)
+ gtk_container_remove (GTK_CONTAINER (priv->image_alignment), old_image);
+
+ gtk_container_add (GTK_CONTAINER (priv->image_alignment), priv->image);
+ gtk_widget_show_all (GTK_WIDGET (priv->image_alignment));
+
+ if (old_image !=NULL)
+ g_object_unref (old_image);
+}
+
+GtkWidget*
+moko_message_dialog_new (void)
+{
+ return g_object_new (MOKO_TYPE_MESSAGE_DIALOG, NULL);
+}
Added: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.h
2007-04-05 08:13:06 UTC (rev 1659)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-message-dialog.h
2007-04-05 08:26:52 UTC (rev 1660)
@@ -0,0 +1,68 @@
+/* moko-dialog.h
+ *
+ * Authored by Rob Bradford <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2007 OpenMoko Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program 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 Public License for more details.
+ *
+ */
+
+#ifndef _MOKO_MESSAGE_DIALOG
+#define _MOKO_MESSAGE_DIALOG
+
+#include "moko-dialog.h"
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_MESSAGE_DIALOG moko_message_dialog_get_type()
+
+#define MOKO_MESSAGE_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MOKO_TYPE_MESSAGE_DIALOG, MokoMessageDialog))
+
+#define MOKO_MESSAGE_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MOKO_TYPE_MESSAGE_DIALOG, MokoMessageDialogClass))
+
+#define MOKO_IS_MESSAGE_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MOKO_TYPE_MESSAGE_DIALOG))
+
+#define MOKO_IS_MESSAGE_DIALOG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MOKO_TYPE_MESSAGE_DIALOG))
+
+#define MOKO_MESSAGE_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MOKO_TYPE_MESSAGE_DIALOG, MokoMessageDialogClass))
+
+typedef struct {
+ GtkDialog parent;
+} MokoMessageDialog;
+
+typedef struct {
+ GtkDialogClass parent_class;
+} MokoMessageDialogClass;
+
+GType moko_message_dialog_get_type (void);
+
+GtkWidget* moko_message_dialog_new (void);
+void moko_message_dialog_set_message (MokoMessageDialog *dialog, const gchar
*message);
+void moko_message_dialog_set_image_from_stock (MokoMessageDialog *dialog,
+ const gchar *stock_id);
+
+G_END_DECLS
+
+#endif /* _MOKO_MESSAGE_DIALOG */
+
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog