Coding style and whitespace cleanups.
This commit is contained in:
committed by
Rodrigo Moya
parent
a6e518dadb
commit
d4b54737d3
@ -190,7 +190,7 @@ static GtkActionEntry internal_mailto_entries[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
render_address_link (GString *buffer, EContact *contact, int map_type)
|
||||
render_address_link (GString *buffer, EContact *contact, gint map_type)
|
||||
{
|
||||
EContactAddress *adr;
|
||||
GString *link = g_string_new ("");
|
||||
@ -645,14 +645,14 @@ render_note_block (GString *buffer, EContact *contact)
|
||||
}
|
||||
|
||||
static void
|
||||
render_address_map (GString *buffer, EContact *contact, int map_type)
|
||||
render_address_map (GString *buffer, EContact *contact, gint map_type)
|
||||
{
|
||||
#ifdef WITH_CONTACT_MAPS
|
||||
if (map_type == E_CONTACT_ADDRESS_WORK) {
|
||||
g_string_append (buffer, "<object classid=\"address-map-work\"></object>");
|
||||
} else {
|
||||
} else {
|
||||
g_string_append (buffer, "<object classid=\"address-map-home\"></object>");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1181,11 +1181,11 @@ handle_map_scroll_event (GtkWidget *widget, GdkEvent *event)
|
||||
static void
|
||||
contact_display_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, EABContactDisplay *display)
|
||||
{
|
||||
EContact *contact = display->priv->contact;
|
||||
const gchar *name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
|
||||
const gchar *contact_uid = e_contact_get_const (contact, E_CONTACT_UID);
|
||||
gchar *full_name;
|
||||
EContactAddress *address;
|
||||
EContact *contact = display->priv->contact;
|
||||
const gchar *name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
|
||||
const gchar *contact_uid = e_contact_get_const (contact, E_CONTACT_UID);
|
||||
gchar *full_name;
|
||||
EContactAddress *address;
|
||||
|
||||
if (g_ascii_strcasecmp (eb->classid, "address-map-work") == 0) {
|
||||
address = e_contact_get (contact, E_CONTACT_ADDRESS_WORK);
|
||||
@ -1196,7 +1196,7 @@ contact_display_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, EABContact
|
||||
}
|
||||
|
||||
if (address) {
|
||||
GtkWidget *map = e_contact_map_new ();
|
||||
GtkWidget *map = e_contact_map_new ();
|
||||
gtk_container_add (GTK_CONTAINER (eb), map);
|
||||
gtk_widget_set_size_request (map, 250, 250);
|
||||
g_signal_connect (E_CONTACT_MAP (map), "contact-added",
|
||||
@ -1344,7 +1344,7 @@ eab_contact_display_init (EABContactDisplay *display)
|
||||
|
||||
#ifdef WITH_CONTACT_MAPS
|
||||
g_signal_connect (web_view, "object-requested",
|
||||
G_CALLBACK (contact_display_object_requested), display);
|
||||
G_CALLBACK (contact_display_object_requested), display);
|
||||
#endif
|
||||
|
||||
action_group = gtk_action_group_new ("internal-mailto");
|
||||
|
||||
@ -82,8 +82,6 @@ typedef enum {
|
||||
ADDRESS_FORMAT_BUSINESS = 1
|
||||
} AddressFormat;
|
||||
|
||||
|
||||
|
||||
void
|
||||
eab_error_dialog (EAlertSink *alert_sink, const gchar *msg, const GError *error)
|
||||
{
|
||||
@ -584,7 +582,6 @@ eab_parse_qp_email_to_html (const gchar *string)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* eab_format_address helper function
|
||||
*
|
||||
@ -643,7 +640,6 @@ get_locales_str (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reads countrytransl.map file, which contains map of localized
|
||||
* country names and their ISO codes and tries to find matching record
|
||||
@ -706,7 +702,6 @@ country_to_ISO (const gchar *country)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Tries to find given key in "country_LANGUAGE" group. When fails to find
|
||||
* such group, then fallbacks to "country" group. When such group does not
|
||||
@ -966,7 +961,7 @@ parse_address_template_section (const gchar *format,
|
||||
bpos1 = pos + 2;
|
||||
bpos2 = find_balanced_bracket (bpos1);
|
||||
|
||||
inner = g_strndup (bpos1 + 1, bpos2 - bpos1 - 2); /* Get inner content of the %0(...) */
|
||||
inner = g_strndup (bpos1 + 1, bpos2 - bpos1 - 2); /* Get inner content of the %0 (...) */
|
||||
replaced = parse_address_template_section (inner, realname, org_name, address, &ires);
|
||||
if (replaced)
|
||||
g_string_append (res, ires);
|
||||
|
||||
@ -58,7 +58,6 @@ gboolean eab_parse_qp_email (const gchar *string,
|
||||
gchar **email);
|
||||
gchar * eab_parse_qp_email_to_html (const gchar *string);
|
||||
|
||||
|
||||
gchar * eab_format_address (EContact *contact,
|
||||
EContactField address_type);
|
||||
|
||||
|
||||
@ -863,7 +863,7 @@ gconf_bridge_bind_window (GConfBridge *bridge,
|
||||
if (gconf_value_get_bool (maximized_val)) {
|
||||
/* maximize is not done immediately, but to count with proper
|
||||
window size, resize it before. The previous size is restored
|
||||
after the maximization is changed, in window_binding_state_event_cb()
|
||||
after the maximization is changed, in window_binding_state_event_cb ()
|
||||
*/
|
||||
gint width = 0, height = 0;
|
||||
GdkScreen *screen;
|
||||
|
||||
@ -242,9 +242,9 @@ contact_editor_contact_modified_cb (EABEditor *editor,
|
||||
static void
|
||||
map_window_show_contact_editor_cb (EContactMapWindow *window,
|
||||
const gchar *contact_uid,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
EShell *shell = e_shell_get_default();
|
||||
EShell *shell = e_shell_get_default ();
|
||||
EBookShellView *book_shell_view = user_data;
|
||||
EBookShellSidebar *book_shell_sidebar;
|
||||
ESource *source;
|
||||
@ -294,21 +294,21 @@ action_address_book_map_cb (GtkAction *action,
|
||||
{
|
||||
#ifdef WITH_CONTACT_MAPS
|
||||
EContactMapWindow *map_window;
|
||||
EBookShellSidebar *book_shell_sidebar;
|
||||
ESource *source;
|
||||
ESourceSelector *selector;
|
||||
EBook *book;
|
||||
GError *error = NULL;
|
||||
EBookShellSidebar *book_shell_sidebar;
|
||||
ESource *source;
|
||||
ESourceSelector *selector;
|
||||
EBook *book;
|
||||
GError *error = NULL;
|
||||
|
||||
book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
|
||||
selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
|
||||
source = e_source_selector_get_primary_selection (selector);
|
||||
book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
|
||||
selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
|
||||
source = e_source_selector_get_primary_selection (selector);
|
||||
|
||||
g_return_if_fail (source != NULL);
|
||||
book = e_book_new (source, &error);
|
||||
if (error != NULL) {
|
||||
g_return_if_fail (source != NULL);
|
||||
book = e_book_new (source, &error);
|
||||
if (error != NULL) {
|
||||
g_warning ("Error loading addressbook: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ book_contacts_received_cb (EBook *book,
|
||||
|
||||
for (p = list; p; p = p->next) {
|
||||
|
||||
e_contact_map_add_contact (window->priv->map, (EContact*)p->data);
|
||||
e_contact_map_add_contact (window->priv->map, (EContact*) p->data);
|
||||
|
||||
}
|
||||
|
||||
@ -159,15 +159,15 @@ map_contact_added_cb (EContactMap *map,
|
||||
|
||||
priv->tasks_cnt--;
|
||||
if (priv->tasks_cnt == 0) {
|
||||
gtk_spinner_stop(GTK_SPINNER (priv->spinner));
|
||||
gtk_spinner_stop (GTK_SPINNER (priv->spinner));
|
||||
gtk_widget_hide (priv->spinner);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
map_contact_removed_cb (EContactMap *map,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
EContactMapWindowPrivate *priv = E_CONTACT_MAP_WINDOW (user_data)->priv;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@ -110,12 +110,12 @@ contact_map_address_resolved_cb (GeoclueGeocode *geocode,
|
||||
|
||||
if (error ||
|
||||
(((fields & GEOCLUE_POSITION_FIELDS_LATITUDE) == 0) && ((fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) == 0))) {
|
||||
const gchar *name;
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
const gchar *name;
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
name = champlain_label_get_text (CHAMPLAIN_LABEL (data->marker));
|
||||
g_signal_emit (data->map, signals[GEOCODING_FAILED], 0, name);
|
||||
goto exit;
|
||||
g_signal_emit (data->map, signals[GEOCODING_FAILED], 0, name);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
priv = data->map->priv;
|
||||
@ -140,7 +140,7 @@ contact_map_address_resolved_cb (GeoclueGeocode *geocode,
|
||||
g_signal_emit (data->map, signals[CONTACT_ADDED], 0, data->marker);
|
||||
|
||||
exit:
|
||||
g_object_unref (data->map);
|
||||
g_object_unref (data->map);
|
||||
g_free (data);
|
||||
|
||||
if (geocode)
|
||||
@ -369,7 +369,7 @@ e_contact_map_zoom_on_marker (EContactMap *map,
|
||||
ClutterActor *marker)
|
||||
{
|
||||
ChamplainView *view;
|
||||
double lat, lng;
|
||||
gdouble lat, lng;
|
||||
|
||||
g_return_if_fail (map && E_IS_CONTACT_MAP (map));
|
||||
g_return_if_fail (marker && CLUTTER_IS_ACTOR (marker));
|
||||
|
||||
@ -79,20 +79,19 @@ struct _EContactMapClass {
|
||||
GType e_contact_map_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * e_contact_map_new (void);
|
||||
|
||||
|
||||
void e_contact_map_add_contact (EContactMap *map,
|
||||
EContact *contact);
|
||||
|
||||
void e_contact_map_add_marker (EContactMap *map,
|
||||
const gchar *name,
|
||||
const gchar *contact_uid,
|
||||
EContactAddress *address,
|
||||
EContactPhoto *photo);
|
||||
void e_contact_map_add_marker (EContactMap *map,
|
||||
const gchar *name,
|
||||
const gchar *contact_uid,
|
||||
EContactAddress *address,
|
||||
EContactPhoto *photo);
|
||||
|
||||
void e_contact_map_remove_contact (EContactMap *map,
|
||||
const gchar *name);
|
||||
|
||||
void e_contact_map_remove_marker (EContactMap *map,
|
||||
void e_contact_map_remove_marker (EContactMap *map,
|
||||
ClutterActor *marker);
|
||||
|
||||
void e_contact_map_zoom_on_marker (EContactMap *map,
|
||||
@ -100,7 +99,6 @@ void e_contact_map_zoom_on_marker (EContactMap *map,
|
||||
|
||||
ChamplainView* e_contact_map_get_view (EContactMap *map);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* WITH_CONTACT_MAPS */
|
||||
|
||||
@ -44,18 +44,18 @@ struct _EContactMarkerPrivate
|
||||
{
|
||||
gchar *contact_uid;
|
||||
|
||||
ClutterActor *image;
|
||||
ClutterActor *text_actor;
|
||||
ClutterActor *image;
|
||||
ClutterActor *text_actor;
|
||||
|
||||
ClutterActor *shadow;
|
||||
ClutterActor *background;
|
||||
ClutterActor *shadow;
|
||||
ClutterActor *background;
|
||||
|
||||
guint total_width;
|
||||
guint total_height;
|
||||
guint total_width;
|
||||
guint total_height;
|
||||
|
||||
ClutterGroup *content_group;
|
||||
ClutterGroup *content_group;
|
||||
|
||||
guint redraw_id;
|
||||
guint redraw_id;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -92,7 +92,7 @@ texture_new_from_pixbuf (GdkPixbuf *pixbuf,
|
||||
ClutterActor *texture = NULL;
|
||||
const guchar *data;
|
||||
gboolean has_alpha, success;
|
||||
int width, height, rowstride;
|
||||
gint width, height, rowstride;
|
||||
ClutterTextureFlags flags = 0;
|
||||
|
||||
data = gdk_pixbuf_get_pixels (pixbuf);
|
||||
@ -114,7 +114,6 @@ texture_new_from_pixbuf (GdkPixbuf *pixbuf,
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
static ClutterActor*
|
||||
contact_photo_to_texture (EContactPhoto *photo)
|
||||
{
|
||||
@ -126,7 +125,7 @@ contact_photo_to_texture (EContactPhoto *photo)
|
||||
GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
|
||||
gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL);
|
||||
gdk_pixbuf_loader_close (loader, NULL);
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
if (pixbuf)
|
||||
g_object_ref (pixbuf);
|
||||
g_object_unref (loader);
|
||||
@ -182,7 +181,6 @@ draw_box (cairo_t *cr,
|
||||
cairo_close_path (cr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_shadow (EContactMarker *marker,
|
||||
gint width,
|
||||
@ -201,36 +199,35 @@ draw_shadow (EContactMarker *marker,
|
||||
scaling = 0.65;
|
||||
x = -40 * slope;
|
||||
|
||||
shadow = clutter_cairo_texture_new (width + x, (height + point));
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (shadow));
|
||||
shadow = clutter_cairo_texture_new (width + x, (height + point));
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (shadow));
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
|
||||
cairo_matrix_init (&matrix, 1, 0, slope, scaling, x, 0);
|
||||
cairo_set_matrix (cr, &matrix);
|
||||
cairo_matrix_init (&matrix, 1, 0, slope, scaling, x, 0);
|
||||
cairo_set_matrix (cr, &matrix);
|
||||
|
||||
draw_box (cr, width, height, point);
|
||||
draw_box (cr, width, height, point);
|
||||
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0.15);
|
||||
cairo_fill (cr);
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0.15);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
clutter_actor_set_position (shadow, 0, height / 2.0);
|
||||
clutter_actor_set_position (shadow, 0, height / 2.0);
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), shadow);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), shadow);
|
||||
|
||||
if (priv->shadow != NULL) {
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
|
||||
priv->shadow);
|
||||
}
|
||||
if (priv->shadow != NULL) {
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
|
||||
priv->shadow);
|
||||
}
|
||||
|
||||
priv->shadow = shadow;
|
||||
priv->shadow = shadow;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_background (EContactMarker *marker,
|
||||
gint width,
|
||||
@ -238,69 +235,68 @@ draw_background (EContactMarker *marker,
|
||||
gint point)
|
||||
{
|
||||
EContactMarkerPrivate *priv = marker->priv;
|
||||
ClutterActor *bg = NULL;
|
||||
ClutterActor *bg = NULL;
|
||||
const ClutterColor *color;
|
||||
ClutterColor darker_color;
|
||||
cairo_t *cr;
|
||||
ClutterColor darker_color;
|
||||
cairo_t *cr;
|
||||
|
||||
bg = clutter_cairo_texture_new (width, height + point);
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
|
||||
bg = clutter_cairo_texture_new (width, height + point);
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
|
||||
/* If selected, add the selection color to the marker's color */
|
||||
if (champlain_marker_get_selected (CHAMPLAIN_MARKER (marker)))
|
||||
color = champlain_marker_get_selection_color ();
|
||||
else
|
||||
color = &DEFAULT_COLOR;
|
||||
if (champlain_marker_get_selected (CHAMPLAIN_MARKER (marker)))
|
||||
color = champlain_marker_get_selection_color ();
|
||||
else
|
||||
color = &DEFAULT_COLOR;
|
||||
|
||||
draw_box (cr, width, height, point);
|
||||
draw_box (cr, width, height, point);
|
||||
|
||||
clutter_color_darken (color, &darker_color);
|
||||
clutter_color_darken (color, &darker_color);
|
||||
|
||||
cairo_set_source_rgba (cr,
|
||||
color->red / 255.0,
|
||||
color->green / 255.0,
|
||||
color->blue / 255.0,
|
||||
color->alpha / 255.0);
|
||||
cairo_fill_preserve (cr);
|
||||
cairo_set_source_rgba (cr,
|
||||
color->red / 255.0,
|
||||
color->green / 255.0,
|
||||
color->blue / 255.0,
|
||||
color->alpha / 255.0);
|
||||
cairo_fill_preserve (cr);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr,
|
||||
darker_color.red / 255.0,
|
||||
darker_color.green / 255.0,
|
||||
darker_color.blue / 255.0,
|
||||
darker_color.alpha / 255.0);
|
||||
cairo_stroke (cr);
|
||||
cairo_destroy (cr);
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_source_rgba (cr,
|
||||
darker_color.red / 255.0,
|
||||
darker_color.green / 255.0,
|
||||
darker_color.blue / 255.0,
|
||||
darker_color.alpha / 255.0);
|
||||
cairo_stroke (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), bg);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), bg);
|
||||
|
||||
if (priv->background != NULL) {
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
|
||||
priv->background);
|
||||
}
|
||||
if (priv->background != NULL) {
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
|
||||
priv->background);
|
||||
}
|
||||
|
||||
priv->background = bg;
|
||||
priv->background = bg;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_marker (EContactMarker *marker)
|
||||
{
|
||||
EContactMarkerPrivate *priv = marker->priv;
|
||||
EContactMarkerPrivate *priv = marker->priv;
|
||||
ChamplainLabel *label = CHAMPLAIN_LABEL (marker);
|
||||
guint height = 0, point = 0;
|
||||
guint total_width = 0, total_height = 0;
|
||||
guint total_width = 0, total_height = 0;
|
||||
ClutterText *text;
|
||||
|
||||
if (priv->image) {
|
||||
clutter_actor_set_position (priv->image, 2*PADDING, 2*PADDING);
|
||||
if (clutter_actor_get_parent (priv->image) == NULL)
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->image);
|
||||
}
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->image);
|
||||
}
|
||||
|
||||
if (priv->text_actor == NULL) {
|
||||
priv->text_actor = clutter_text_new_with_text ("Serif 8",
|
||||
@ -309,8 +305,8 @@ draw_marker (EContactMarker *marker)
|
||||
}
|
||||
|
||||
text = CLUTTER_TEXT (priv->text_actor);
|
||||
clutter_text_set_text (text,
|
||||
champlain_label_get_text (label));
|
||||
clutter_text_set_text (text,
|
||||
champlain_label_get_text (label));
|
||||
clutter_text_set_font_name (text,
|
||||
champlain_label_get_font_name (label));
|
||||
clutter_text_set_line_alignment (text, PANGO_ALIGN_CENTER);
|
||||
@ -324,48 +320,48 @@ draw_marker (EContactMarker *marker)
|
||||
champlain_label_get_use_markup (label));
|
||||
|
||||
if (priv->image) {
|
||||
clutter_actor_set_width (priv->text_actor,
|
||||
clutter_actor_get_width (priv->image));
|
||||
clutter_actor_set_width (priv->text_actor,
|
||||
clutter_actor_get_width (priv->image));
|
||||
total_height = clutter_actor_get_height (priv->image) + 2*PADDING +
|
||||
clutter_actor_get_height (priv->text_actor) + 2*PADDING;
|
||||
total_width = clutter_actor_get_width (priv->image) + 4*PADDING;
|
||||
clutter_actor_set_position (priv->text_actor, PADDING,
|
||||
clutter_actor_get_height (priv->image)+2*PADDING+3);
|
||||
clutter_actor_set_position (priv->text_actor, PADDING,
|
||||
clutter_actor_get_height (priv->image)+2*PADDING+3);
|
||||
} else {
|
||||
total_height = clutter_actor_get_height (priv->text_actor) + 2*PADDING;
|
||||
total_width = clutter_actor_get_width (priv->text_actor) + 4*PADDING;
|
||||
clutter_actor_set_position (priv->text_actor, 2 * PADDING, PADDING);
|
||||
clutter_actor_set_position (priv->text_actor, 2 * PADDING, PADDING);
|
||||
}
|
||||
|
||||
height += 2 * PADDING;
|
||||
if (height > total_height)
|
||||
total_height = height;
|
||||
height += 2 * PADDING;
|
||||
if (height > total_height)
|
||||
total_height = height;
|
||||
|
||||
clutter_text_set_color (CLUTTER_TEXT (priv->text_actor),
|
||||
(champlain_marker_get_selected (CHAMPLAIN_MARKER (marker)) ?
|
||||
champlain_marker_get_selection_text_color () :
|
||||
champlain_label_get_text_color (CHAMPLAIN_LABEL (marker))));
|
||||
if (clutter_actor_get_parent (priv->text_actor) == NULL)
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->text_actor);
|
||||
clutter_text_set_color (CLUTTER_TEXT (priv->text_actor),
|
||||
(champlain_marker_get_selected (CHAMPLAIN_MARKER (marker)) ?
|
||||
champlain_marker_get_selection_text_color () :
|
||||
champlain_label_get_text_color (CHAMPLAIN_LABEL (marker))));
|
||||
if (clutter_actor_get_parent (priv->text_actor) == NULL)
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (priv->content_group), priv->text_actor);
|
||||
|
||||
if (priv->text_actor == NULL && priv->image == NULL) {
|
||||
total_width = 6 * PADDING;
|
||||
total_height = 6 * PADDING;
|
||||
}
|
||||
total_width = 6 * PADDING;
|
||||
total_height = 6 * PADDING;
|
||||
}
|
||||
|
||||
point = (total_height + 2 * PADDING) / 4.0;
|
||||
priv->total_width = total_width;
|
||||
priv->total_height = total_height;
|
||||
point = (total_height + 2 * PADDING) / 4.0;
|
||||
priv->total_width = total_width;
|
||||
priv->total_height = total_height;
|
||||
|
||||
draw_shadow (marker, total_width, total_height, point);
|
||||
draw_background (marker, total_width, total_height, point);
|
||||
draw_shadow (marker, total_width, total_height, point);
|
||||
draw_background (marker, total_width, total_height, point);
|
||||
|
||||
if (priv->text_actor != NULL && priv->background != NULL)
|
||||
clutter_actor_raise (priv->text_actor, priv->background);
|
||||
if (priv->image != NULL && priv->background != NULL)
|
||||
clutter_actor_raise (priv->image, priv->background);
|
||||
if (priv->text_actor != NULL && priv->background != NULL)
|
||||
clutter_actor_raise (priv->text_actor, priv->background);
|
||||
if (priv->image != NULL && priv->background != NULL)
|
||||
clutter_actor_raise (priv->image, priv->background);
|
||||
|
||||
clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), 0, total_height + point);
|
||||
clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), 0, total_height + point);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -375,7 +371,7 @@ redraw_on_idle (gpointer gobject)
|
||||
|
||||
draw_marker (marker);
|
||||
marker->priv->redraw_id = 0;
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -402,10 +398,10 @@ allocate (ClutterActor *self,
|
||||
CLUTTER_ACTOR_CLASS (e_contact_marker_parent_class)->allocate (self, box, flags);
|
||||
|
||||
child_box.x1 = 0;
|
||||
child_box.x2 = box->x2 - box->x1;
|
||||
child_box.y1 = 0;
|
||||
child_box.y2 = box->y2 - box->y1;
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (priv->content_group), &child_box, flags);
|
||||
child_box.x2 = box->x2 - box->x1;
|
||||
child_box.y1 = 0;
|
||||
child_box.y2 = box->y2 - box->y1;
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (priv->content_group), &child_box, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -423,7 +419,7 @@ map (ClutterActor *self)
|
||||
|
||||
CLUTTER_ACTOR_CLASS (e_contact_marker_parent_class)->map (self);
|
||||
|
||||
clutter_actor_map (CLUTTER_ACTOR (priv->content_group));
|
||||
clutter_actor_map (CLUTTER_ACTOR (priv->content_group));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -441,7 +437,7 @@ pick (ClutterActor *self,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
EContactMarkerPrivate *priv = E_CONTACT_MARKER (self)->priv;
|
||||
gfloat width, height;
|
||||
gfloat width, height;
|
||||
|
||||
if (!clutter_actor_should_pick_paint (self))
|
||||
return;
|
||||
@ -451,28 +447,28 @@ pick (ClutterActor *self,
|
||||
|
||||
cogl_path_new ();
|
||||
|
||||
cogl_set_source_color4ub (color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
cogl_set_source_color4ub (color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
|
||||
cogl_path_move_to (RADIUS, 0);
|
||||
cogl_path_line_to (width - RADIUS, 0);
|
||||
cogl_path_arc (width - RADIUS, RADIUS, RADIUS, RADIUS, -90, 0);
|
||||
cogl_path_line_to (width, height - RADIUS);
|
||||
cogl_path_arc (width - RADIUS, height - RADIUS, RADIUS, RADIUS, 0, 90);
|
||||
cogl_path_line_to (RADIUS, height);
|
||||
cogl_path_arc (RADIUS, height - RADIUS, RADIUS, RADIUS, 90, 180);
|
||||
cogl_path_line_to (0, RADIUS);
|
||||
cogl_path_arc (RADIUS, RADIUS, RADIUS, RADIUS, 180, 270);
|
||||
cogl_path_close ();
|
||||
cogl_path_fill ();
|
||||
cogl_path_line_to (width - RADIUS, 0);
|
||||
cogl_path_arc (width - RADIUS, RADIUS, RADIUS, RADIUS, -90, 0);
|
||||
cogl_path_line_to (width, height - RADIUS);
|
||||
cogl_path_arc (width - RADIUS, height - RADIUS, RADIUS, RADIUS, 0, 90);
|
||||
cogl_path_line_to (RADIUS, height);
|
||||
cogl_path_arc (RADIUS, height - RADIUS, RADIUS, RADIUS, 90, 180);
|
||||
cogl_path_line_to (0, RADIUS);
|
||||
cogl_path_arc (RADIUS, RADIUS, RADIUS, RADIUS, 180, 270);
|
||||
cogl_path_close ();
|
||||
cogl_path_fill ();
|
||||
}
|
||||
|
||||
static void
|
||||
notify_selected (GObject *gobject,
|
||||
G_GNUC_UNUSED GParamSpec *pspec,
|
||||
G_GNUC_UNUSED gpointer user_data)
|
||||
G_GNUC_UNUSED GParamSpec *pspec,
|
||||
G_GNUC_UNUSED gpointer user_data)
|
||||
{
|
||||
queue_redraw (E_CONTACT_MARKER (gobject));
|
||||
}
|
||||
@ -505,20 +501,20 @@ e_contact_marker_dispose (GObject *object)
|
||||
priv->text_actor = NULL;
|
||||
|
||||
if (priv->content_group) {
|
||||
clutter_actor_unparent (CLUTTER_ACTOR (priv->content_group));
|
||||
priv->content_group = NULL;
|
||||
}
|
||||
clutter_actor_unparent (CLUTTER_ACTOR (priv->content_group));
|
||||
priv->content_group = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (e_contact_marker_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (e_contact_marker_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
e_contact_marker_class_init (EContactMarkerClass *class)
|
||||
{
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
g_type_class_add_private (class, sizeof (EContactMarkerPrivate));
|
||||
g_type_class_add_private (class, sizeof (EContactMarkerPrivate));
|
||||
|
||||
object_class->dispose = e_contact_marker_dispose;
|
||||
object_class->finalize = e_contact_marker_finalize;
|
||||
@ -545,7 +541,7 @@ e_contact_marker_init (EContactMarker *marker)
|
||||
EContactMarkerPrivate *priv;
|
||||
|
||||
priv = G_TYPE_INSTANCE_GET_PRIVATE (
|
||||
marker, E_TYPE_CONTACT_MARKER, EContactMarkerPrivate);
|
||||
marker, E_TYPE_CONTACT_MARKER, EContactMarkerPrivate);
|
||||
|
||||
marker->priv = priv;
|
||||
priv->contact_uid = NULL;
|
||||
@ -556,11 +552,11 @@ e_contact_marker_init (EContactMarker *marker)
|
||||
priv->content_group = CLUTTER_GROUP (clutter_group_new ());
|
||||
priv->redraw_id = 0;
|
||||
|
||||
clutter_actor_set_parent (CLUTTER_ACTOR (priv->content_group), CLUTTER_ACTOR (marker));
|
||||
clutter_actor_set_parent (CLUTTER_ACTOR (priv->content_group), CLUTTER_ACTOR (marker));
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (marker));
|
||||
|
||||
priv->total_width = 0;
|
||||
priv->total_height = 0;
|
||||
priv->total_width = 0;
|
||||
priv->total_height = 0;
|
||||
|
||||
g_signal_connect (marker, "notify::selected",
|
||||
G_CALLBACK (notify_selected), NULL);
|
||||
@ -571,7 +567,7 @@ e_contact_marker_init (EContactMarker *marker)
|
||||
ClutterActor *
|
||||
e_contact_marker_new (const gchar *name,
|
||||
const gchar *contact_uid,
|
||||
EContactPhoto *photo)
|
||||
EContactPhoto *photo)
|
||||
{
|
||||
ClutterActor *marker = CLUTTER_ACTOR (g_object_new (E_TYPE_CONTACT_MARKER, NULL));
|
||||
EContactMarkerPrivate *priv = E_CONTACT_MARKER (marker)->priv;
|
||||
@ -589,7 +585,7 @@ e_contact_marker_new (const gchar *name,
|
||||
return marker;
|
||||
}
|
||||
|
||||
const gchar*
|
||||
const gchar *
|
||||
e_contact_marker_get_contact_uid (EContactMarker *marker)
|
||||
{
|
||||
g_return_val_if_fail (marker && E_IS_CONTACT_MARKER (marker), NULL);
|
||||
|
||||
@ -58,8 +58,8 @@ typedef struct _EContactMarkerClass EContactMarkerClass;
|
||||
|
||||
struct _EContactMarker
|
||||
{
|
||||
ChamplainLabel parent;
|
||||
EContactMarkerPrivate *priv;
|
||||
ChamplainLabel parent;
|
||||
EContactMarkerPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EContactMarkerClass
|
||||
@ -69,14 +69,13 @@ struct _EContactMarkerClass
|
||||
void (*double_clicked) (ClutterActor *actor);
|
||||
};
|
||||
|
||||
GType e_contact_marker_get_type (void);
|
||||
|
||||
GType e_contact_marker_get_type (void);
|
||||
ClutterActor* e_contact_marker_new (const gchar *name,
|
||||
const gchar *contact_uid,
|
||||
EContactPhoto *photo);
|
||||
|
||||
ClutterActor* e_contact_marker_new (const gchar *name,
|
||||
const gchar *contact_uid,
|
||||
EContactPhoto *photo);
|
||||
|
||||
const gchar* e_contact_marker_get_contact_uid (EContactMarker *marker);
|
||||
const gchar * e_contact_marker_get_contact_uid (EContactMarker *marker);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user