aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-gui-utils.c
blob: f7e2d946c647bd0fc4d4cd2498eadbb3fa6117c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * GUI utility functions
 *
 * Author:
 *   Miguel de Icaza (miguel@helixcode.com)
 *
 * (C) 1999 Miguel de Icaza
 * (C) 2000 Helix Code, Inc.
 */
#include <config.h>
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-messagebox.h>
#include <libgnomeui/gnome-stock.h>
#include <gnome.h>
#include "e-gui-utils.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>

void
e_notice (GtkWindow *window, const char *type, const char *format, ...)
{
    GtkWidget *dialog;
    va_list args;
    char *str;

    va_start (args, format);
    str = g_strdup_vprintf (format, args);
    dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL);
    va_end (args);
    g_free (str);
    
    if (window)
        gnome_dialog_set_parent (GNOME_DIALOG (dialog), window);

    gnome_dialog_run (GNOME_DIALOG (dialog));
}

static void
kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
{
    g_return_if_fail (menu != NULL);
    g_return_if_fail (GTK_IS_MENU (menu));

    gtk_object_unref (GTK_OBJECT (menu));
}

void
e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
{
    g_return_if_fail (menu != NULL);
    g_return_if_fail (GTK_IS_MENU (menu));

    gtk_signal_connect (GTK_OBJECT (menu), "hide",
                GTK_SIGNAL_FUNC (kill_popup_menu), menu);
}

void
e_popup_menu (GtkMenu *menu, GdkEventButton *event)
{
    g_return_if_fail (menu != NULL);
    g_return_if_fail (GTK_IS_MENU (menu));

    e_auto_kill_popup_menu_on_hide (menu);
    gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
}

GtkWidget *e_create_image_widget(gchar *name,
                 gchar *string1, gchar *string2,
                 gint int1, gint int2)
{
    char *filename;
    GdkPixbuf *pixbuf;
    double width, height;
    GtkWidget *canvas, *alignment;
    if (string1) {
        if (*string1 == '/')
            filename = g_strdup(string1);
        else
            filename = g_concat_dir_and_file(EVOLUTION_IMAGES, string1);
        pixbuf = gdk_pixbuf_new_from_file(filename);
        width = gdk_pixbuf_get_width(pixbuf);
        height = gdk_pixbuf_get_height(pixbuf);

        canvas = gnome_canvas_new_aa();
        GTK_OBJECT_UNSET_FLAGS(GTK_WIDGET(canvas), GTK_CAN_FOCUS);
        gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(canvas)),
                      gnome_canvas_pixbuf_get_type(),

                      "pixbuf", pixbuf,
                      NULL);

        alignment = gtk_widget_new(gtk_alignment_get_type(),
                       "child", canvas,
                       "xalign", (double) 0,
                       "yalign", (double) 0,
                       "xscale", (double) 0,
                       "yscale", (double) 0,
                       NULL);
    
        gtk_widget_set_usize(canvas, width, height);

        gdk_pixbuf_unref(pixbuf);

        gtk_widget_show(canvas);
        gtk_widget_show(alignment);
        g_free(filename);

        return alignment;
    } else
        return NULL;
}

w44/cgit/cgit.cgi/freebsd-ports-gnome/commit/?h=gstreamer0.10-removal&id=2d3daf440964c825a42d04169833508658bdc0f2'>s,machine/smb.h,dev/smbus/smb.h,brian2005-08-014-0/+44 * convey --> ports/net/conveyhq2005-08-011-0/+1 * Convey allows people across the globe to collaboratively draw images whilehq2005-08-0111-0/+149 * Remove a superfluous part of a patch (patching a .orig file resulting fromjoerg2005-08-012-168/+0 * - Update to 3.1sem2005-08-013-11/+11 * openacs -> ports/www/openacslawrance2005-08-011-0/+1 * Add openacs:lawrance2005-08-019-0/+510 * - Update to 2005_07_20-19_29_UTCgarga2005-08-014-3/+51 * Unbreak on 4.xgarga2005-08-013-21/+19 * - Update to 5.7.2sem2005-08-013-4/+4 * Update to 3.41.osa2005-08-012-3/+3 * Update to 3.19.osa2005-08-012-3/+3 * s,machine/smb.h,dev/smbus/smb.h,brian2005-08-013-0/+33 * - Update to 0.3.0sem2005-08-014-70/+68 * Chase a silent update and make fetchable again.thierry2005-08-012-2/+3 * - Update to 0.1.4clement2005-08-014-8/+10 * Register CONFLICTSgarga2005-08-012-1/+3 * Update to 10.2.danfe2005-08-013-91/+91 * Fix build failure on 4.x.kuriyama2005-08-012-0/+8 * Add GTKPool, a 2D pool game using the GTK+ toolkit.danfe2005-08-0110-0/+184 * - drop option LDAP_PORTdinoex2005-08-011-6/+0 * - drop openldap21-clientdinoex2005-08-011-7/+1 * Remove obsolete patch.lofi2005-08-013-15180/+0 * - Fix path issues.flz2005-08-011-3/+5 * eclipse-viplugin --> ports/java/eclipse-vipluginnork2005-08-011-0/+1 * Add eclipse-viPlugin 1.12.1, an Eclipse plugin that addsnork2005-08-015-0/+63 * Fixup plist and man lists for alpha and sparc64.lesi2005-08-012-23/+42 * - Fix build if rrdtool 1.2 is intalledclement2005-08-012-0/+12 * - Update to 1.4.0.5garga2005-08-014-27/+6 * - make sure SSL dependency doesn't exists if WITHOUT_MODULES_SSL is definedclement2005-08-014-4/+24 * Update to 20050726 snapshot.vsevolod2005-08-018-491/+123 * - set ${SHORTMODNAME} to fix LoadModule line in httpd.confclement2005-08-011-0/+1 * - Update to 5.0r6clement2005-08-014-46/+20 * - Update to 0.5clement2005-08-012-3/+3 * - Pass maintainership to Vasil Dimov <vd _at_ datamax _dot_ bg>clement2005-08-011-1/+1 * Update to 0.7002.skv2005-08-012-3/+3 * - Update to 0.7.0-1 (bugfix release).flz2005-08-014-6/+8 * Update to 0.04skv2005-08-012-3/+3 * Update to 0.9801skv2005-08-012-3/+3 * Unbreak firebird-client build - remove "chown" for "employee.fdb"skv2005-08-013-6/+0 * Update to 0.13.0, see release note for detail:mezz2005-08-0110-51/+16 * - Project is finally alive again and moved to Sourceforge.flz2005-08-014-10/+10 * Update MASTER_SITES and WWW: linevs2005-08-012-2/+2 * Upgrade to 1.1.thierry2005-08-014-23/+4 * Update to 0.3.0.nork2005-08-013-5/+20 * Improve reliability of the do-install target. In the previous versionhrs2005-08-011-1/+3 * Update to 20050731:skv2005-08-012-4/+3 * Added nbsmtp format string vulnerability.niels2005-08-011-0/+28 * Upgrade to 3.6.0.obraun2005-08-012-3/+3 * - fix empty dirdinoex2005-08-011-0/+1 * Update WWWarved2005-08-011-1/+1 * - fix empty dirdinoex2005-08-011-0/+1 * - fix empty dirdinoex2005-08-011-0/+1 * - fix empty dirdinoex2005-08-011-1/+0 * o UnBROKEN because extra files are listed in print/acroread.nork2005-08-011-4/+2 * - fix empty dirdinoex2005-08-011-0/+2 * Many thanks to hrs who kept track of my emergency call, and tojoerg2005-08-015-33/+353 * Upgrade to version 3.7joerg2005-08-013-3/+6 * Upgrade to 1.2.5.joerg2005-08-012-3/+3 * - Fix dependency on p5-TimeDate, not p5-DateTime.kuriyama2005-08-013-4/+5 * Fix build on 6lawrance2005-08-011-0/+19 * Update to 0.1.2.marcus2005-08-016-6/+8 * Use libtiff from the port rather than the version bundled with gdallawrance2005-08-011-3/+6 * Change the guint64 size type to a long. While this will result in LARGEmarcus2005-08-011-5/+14 * - Fix plistperky2005-08-013-10/+5 * Fix yet another thread-safety bug:jylefort2005-08-012-0/+31 * Really unbreak WITH_BOOK option by creating the book directorybmah2005-08-014-4/+8 * - Update to 1.72leeym2005-08-012-3/+7 * Update from 2.50 to 3.01. Transfer maintainership to the submitter.mi2005-08-014-12/+54 * Grab a patch for keyboard on sparc64 from Xorg CVS. This makes 'kbd' driverlesi2005-08-014-31/+36 * Mark latest the linux-tiff and pdflib ports safe from latest tiffsimon2005-08-011-1/+8 * Remove patches which have been applied upstream.lofi2005-08-017-497/+0 * Add koffice-i18n-sr@Latn and koffice-i18n-talofi2005-08-011-0/+2 * Update to KDE 3.4.2 / KOffice 1.4.1lofi2005-08-01