Git-Url:
http://git.frugalware.org/gitweb/gitweb.cgi?p=gfpm.git;a=commitdiff;h=fc855111b2e46bb559c6347f949e94b4d368ca4c
commit fc855111b2e46bb559c6347f949e94b4d368ca4c
Author: Priyank <[EMAIL PROTECTED]>
Date: Wed Sep 5 11:56:47 2007 +0530
gfpm-messages: allow setting message title for different dialogs like
(question, input, message, error, etc)
diff --git a/data/gfpm.glade b/data/gfpm.glade
index 34ffe64..71e2bb1 100644
--- a/data/gfpm.glade
+++ b/data/gfpm.glade
@@ -629,9 +629,6 @@ Installed packages</property>
<property name="position">2</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</widget>
</child>
</widget>
diff --git a/src/gfpm-interface.c b/src/gfpm-interface.c
index 72ac31c..8d03ffe 100644
--- a/src/gfpm-interface.c
+++ b/src/gfpm-interface.c
@@ -262,12 +262,12 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer
data)
if (!gfpm_package_list_is_empty(GFPM_INSTALL_LIST) &&
!gfpm_package_list_is_empty(GFPM_REMOVE_LIST))
{
- gfpm_message (_("No changes to apply."));
+ gfpm_message (_("Gfpm"), _("No changes to apply."));
return;
}
if (gfpm_apply_dlg_show() != GTK_RESPONSE_OK)
{
- if (gfpm_question(_("Are you sure you want to cancel this
operation ? \nNote: All changes made till now will be
reverted."))==GTK_RESPONSE_YES)
+ if (gfpm_question(_("Cancel Operation"), _("Are you sure you
want to cancel this operation ? \nNote: All changes made till now will be
reverted."))==GTK_RESPONSE_YES)
{
/* revert all changes */
gfpm_package_list_free (GFPM_INSTALL_LIST);
@@ -294,7 +294,7 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer data)
if (pm_errno == PM_ERR_HANDLE_LOCK)
errorstr = g_string_append (errorstr,
_("If you're sure a package manager is not already running, you can delete
/tmp/pacman-g2.lck"));
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
return;
}
@@ -316,7 +316,7 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer data)
{
char *str = g_strdup_printf ("Failed to commit transaction (%s)",
pacman_strerror(pm_errno));
errorstr = g_string_append (errorstr, str);
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
g_free (str);
g_string_free (errorstr, FALSE);
return;
@@ -345,7 +345,7 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer data)
if (pm_errno == PM_ERR_HANDLE_LOCK)
errorstr = g_string_append (errorstr,
_("If you're sure a package manager is not already running, you can delete
/tmp/pacman-g2.lck"));
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
return;
}
@@ -360,14 +360,14 @@ cb_gfpm_apply_btn_clicked (GtkButton *button, gpointer
data)
if (gfpm_trans_prepare(data) == -1)
goto cleanup;
pkgs = pacman_trans_getinfo (PM_TRANS_PACKAGES);
- if (pkgs == NULL) gfpm_error ("Error getting transaction info");
+ if (pkgs == NULL) gfpm_error (_("Error"), "Error getting
transaction info");
/* commit transaction */
if (pacman_trans_commit(&data) == -1)
{
char *str = g_strdup_printf ("Failed to commit transaction (%s)",
pacman_strerror(pm_errno));
errorstr = g_string_append (errorstr, str);
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
g_free (str);
g_string_free (errorstr, FALSE);
return;
@@ -865,7 +865,7 @@ gfpm_trans_prepare (PM_LIST *list)
GList *pkgs = NULL;
gchar *str = NULL;
str = g_strdup_printf (_("Failed to prepare transaction (%s)\n"),
pacman_strerror (pm_errno));
- gfpm_error (str);
+ gfpm_error (_("Error"), str);
g_free (str);
switch ((long)pm_errno)
{
@@ -896,7 +896,7 @@ gfpm_trans_prepare (PM_LIST *list)
g_string_free (depstring, FALSE);
}
pacman_list_free (list);
- gfpm_plist_message (_("Following dependencies
were not met. Please install these packages first."), GTK_MESSAGE_WARNING,
pkgs);
+ gfpm_plist_message (_("Missing dependencies"),
_("Following dependencies were not met. Please install these packages first."),
GTK_MESSAGE_WARNING, pkgs);
break;
case PM_ERR_CONFLICTING_DEPS:
for (i=pacman_list_first(list);i;i=pacman_list_next(i))
@@ -908,7 +908,7 @@ gfpm_trans_prepare (PM_LIST *list)
g_string_free (depstring, FALSE);
}
pacman_list_free (list);
- gfpm_plist_message (_("This package conflicts
with the following packages"), GTK_MESSAGE_WARNING, pkgs);
+ gfpm_plist_message (_("Package conflict"),
_("This package conflicts with the following packages"), GTK_MESSAGE_WARNING,
pkgs);
break;
}
return -1;
@@ -942,7 +942,7 @@ cb_gfpm_refresh_button_clicked (GtkButton *button, gpointer
data)
if (strcmp((char*)pacman_pkg_getinfo(pm_lpkg, PM_PKG_VERSION),
(char*)pacman_pkg_getinfo(pm_spkg, PM_PKG_VERSION)))
{
- if (gfpm_question (updatestr) == GTK_RESPONSE_YES)
+ if (gfpm_question (_("Update pacman-g2"), updatestr) ==
GTK_RESPONSE_YES)
{
gfpm_package_list_add (GFPM_INSTALL_LIST, "pacman-g2");
cb_gfpm_apply_btn_clicked (NULL, NULL);
@@ -959,7 +959,7 @@ cb_gfpm_refresh_button_clicked (GtkButton *button, gpointer
data)
if (pm_errno == PM_ERR_HANDLE_LOCK)
errorstr = g_string_append (errorstr,
_("If you're sure a package manager is not already running, you can delete
/tmp/pacman-g2.lck"));
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
return;
}
if (pacman_trans_sysupgrade()==-1)
@@ -974,11 +974,11 @@ cb_gfpm_refresh_button_clicked (GtkButton *button,
gpointer data)
better way to check this!! */
if (pacman_list_count(packages) <= 0)
{
- gfpm_message (_("No changes to apply."));
+ gfpm_message ("Gfpm", _("No changes to apply."));
goto cleanup;
} /* FIXME END */
- if (gfpm_plist_question(_("Following packages will be upgraded. Do you
want to continue ?"), gfpm_pmlist_to_glist(packages)) == GTK_RESPONSE_YES)
+ if (gfpm_plist_question(_("Package upgrade"), _("Following packages
will be upgraded. Do you want to continue ?"), gfpm_pmlist_to_glist(packages))
== GTK_RESPONSE_YES)
{
/*
PM_LIST *i = NULL;
@@ -1171,7 +1171,7 @@ cb_gfpm_search_keypress (GtkWidget *widget, GdkEventKey
*event, gpointer data)
if (l == NULL)
{
gfpm_update_status (_("Search Complete"));
- gfpm_error (_("No package found"));
+ gfpm_error (_("Package not found"), _("No such package found"));
return;
}
icon_yes = gfpm_get_icon (ICON_INSTALLED, 16);
@@ -1331,17 +1331,17 @@ cb_gfpm_clear_cache_apply_clicked (GtkButton *button,
gpointer data)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfpm_clrold_opt)) == TRUE)
{
- if (gfpm_question(_("Are you sure you want to remove old
packages from cache ?")) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Clear package cache"), _("Are you sure you
want to remove old packages from cache ?")) == GTK_RESPONSE_YES)
{
while (gtk_events_pending())
gtk_main_iteration ();
ret = pacman_sync_cleancache (0);
if (!ret)
- gfpm_message (_("Finished clearing the cache"));
+ gfpm_message ("Gfpm", _("Finished clearing the
cache"));
else
{
errstr = g_strdup_printf (_("Failed to clean the cache (%s)"),
pacman_strerror(pm_errno));
- gfpm_message (errstr);
+ gfpm_error (_("Error clearing cache"), errstr);
g_free (errstr);
}
}
@@ -1349,17 +1349,17 @@ cb_gfpm_clear_cache_apply_clicked (GtkButton *button,
gpointer data)
}
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfpm_clrall_opt)) ==
TRUE)
{
- if (gfpm_question(_("Are you sure you want to remove all
packages from cache ?")) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Clear package cache"), _("Are you sure you
want to remove all packages from cache ?")) == GTK_RESPONSE_YES)
{
while (gtk_events_pending())
gtk_main_iteration ();
ret = pacman_sync_cleancache (1);
if (!ret)
- gfpm_message (_("Finished clearing the cache"));
+ gfpm_message ("Gfpm", _("Finished clearing the
cache"));
else
{
errstr = g_strdup_printf (_("Failed to clean the cache (%s)"),
pacman_strerror(pm_errno));
- gfpm_message (errstr);
+ gfpm_message (_("Error clearing cache"),
errstr);
g_free (errstr);
}
}
@@ -1381,10 +1381,10 @@ cb_gfpm_install_file_clicked (GtkButton *button,
gpointer data)
fpm = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(gfpm_inst_filechooser));
if (fpm == NULL)
{
- gfpm_error (_("No package selected for install. Please select a
package to install."));
+ gfpm_error (_("No packages selected"), _("No package selected
for install. Please select a package to install."));
return;
}
- if (gfpm_question(_("Are you sure you want to install this package ?"))
!= GTK_RESPONSE_YES)
+ if (gfpm_question(_("Install package"), _("Are you sure you want to
install this package ?")) != GTK_RESPONSE_YES)
return;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfpm_inst_upgcheck)))
type = PM_TRANS_TYPE_UPGRADE;
@@ -1401,7 +1401,7 @@ cb_gfpm_install_file_clicked (GtkButton *button, gpointer
data)
if (pm_errno == PM_ERR_HANDLE_LOCK)
{ errorstr = g_string_append (errorstr,
_("If you're sure a package manager is not already running, you can delete
/tmp/pacman-g2.lck"));
- gfpm_error (errorstr->str);
+ gfpm_error (_("Error"), errorstr->str);
}
return;
}
@@ -1413,13 +1413,13 @@ cb_gfpm_install_file_clicked (GtkButton *button,
gpointer data)
if (pacman_trans_commit(&trans_data) == -1)
{
str = g_strdup_printf (_("Failed to commit transaction (%s)\n"),
pacman_strerror (pm_errno));
- gfpm_error (str);
+ gfpm_error (_("Error"), str);
g_free (str);
goto cleanup;
}
else
{
- gfpm_message (_("Package successfully installed"));
+ gfpm_message ("Gfpm", _("Package successfully installed"));
}
cleanup:
diff --git a/src/gfpm-messages.c b/src/gfpm-messages.c
index 1197e62..9c13510 100644
--- a/src/gfpm-messages.c
+++ b/src/gfpm-messages.c
@@ -221,7 +221,7 @@ gfpm_apply_dlg_show_rem_box (gboolean show)
void
-gfpm_error (const char *error_str)
+gfpm_error (const char *message_title, const char *error_str)
{
GtkWidget *error_dlg = NULL;
@@ -235,6 +235,7 @@ gfpm_error (const char *error_str)
"%s",
error_str);
gtk_window_set_resizable (GTK_WINDOW(error_dlg), FALSE);
+ gtk_window_set_title (GTK_WINDOW(error_dlg), message_title);
gtk_dialog_run (GTK_DIALOG(error_dlg));
gtk_widget_destroy (error_dlg);
@@ -242,7 +243,7 @@ gfpm_error (const char *error_str)
}
void
-gfpm_message (const char *message_str)
+gfpm_message (const char *message_title, const char *message_str)
{
GtkWidget *message_dlg;
@@ -253,6 +254,7 @@ gfpm_message (const char *message_str)
"%s",
message_str);
gtk_window_set_resizable (GTK_WINDOW(message_dlg), FALSE);
+ gtk_window_set_title (GTK_WINDOW(message_dlg), message_title);
gtk_dialog_run (GTK_DIALOG(message_dlg));
gtk_widget_destroy (message_dlg);
@@ -260,7 +262,7 @@ gfpm_message (const char *message_str)
}
gint
-gfpm_question (const char *message_str)
+gfpm_question (const char *message_title, const char *message_str)
{
GtkWidget *dialog;
gint ret;
@@ -272,6 +274,7 @@ gfpm_question (const char *message_str)
"%s",
message_str);
gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE);
+ gtk_window_set_title (GTK_WINDOW(dialog), message_title);
ret = gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
@@ -279,7 +282,7 @@ gfpm_question (const char *message_str)
}
gint
-gfpm_plist_question (const char *main_msg, GList *packages)
+gfpm_plist_question (const char *message_title, const char *main_msg, GList
*packages)
{
GtkWidget *dialog;
GtkListStore *store;
@@ -349,6 +352,7 @@ gfpm_plist_question (const char *main_msg, GList *packages)
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(swindow),
FALSE, FALSE, 0);
gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE);
+ gtk_window_set_title (GTK_WINDOW(dialog), message_title);
ret = gtk_dialog_run (GTK_DIALOG(dialog));
if (ret == GTK_RESPONSE_YES)
@@ -394,7 +398,7 @@ cb_gfpm_plist_question_upgrade_toggled
(GtkCellRendererToggle *toggle, gchar *pa
}
void
-gfpm_plist_message (const char *main_msg, GtkMessageType type, GList *packages)
+gfpm_plist_message (const char *message_title, const char *main_msg,
GtkMessageType type, GList *packages)
{
GtkWidget *dialog;
GtkListStore *store;
@@ -433,6 +437,7 @@ gfpm_plist_message (const char *main_msg, GtkMessageType
type, GList *packages)
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(swindow),
FALSE, FALSE, 0);
gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE);
+ gtk_window_set_title (GTK_WINDOW(dialog), message_title);
gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
@@ -487,7 +492,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME),
(char*)data3,
(char*)pacman_pkg_getinfo (data2, PM_PKG_NAME));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Replace package"), _(str)) ==
GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -496,7 +501,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
str = g_strdup_printf ("%s requires %s, but it is IgnorePkg. Install anyway?",
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME),
(char*)pacman_pkg_getinfo (data2, PM_PKG_NAME));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question("Gfpm", _(str)) == GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -504,7 +509,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
case PM_TRANS_CONV_REMOVE_HOLDPKG:
str = g_strdup_printf ("%s is designated as HoldPkg. Remove anyway?",
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question("Gfpm", _(str)) == GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -514,7 +519,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
(char*)data1,
(char*)data2,
(char*)data2);
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Conflict"), _(str)) ==
GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -523,7 +528,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
str = g_strdup_printf ("%s-%s: local version is newer. Upgrade anyway?",
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME),
(char*)pacman_pkg_getinfo (data1, PM_PKG_VERSION));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Local version newer"), _(str)) ==
GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -532,7 +537,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
str = g_strdup_printf ("%s-%s: local version is up to date. Upgrade anyway?",
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME),
(char*)pacman_pkg_getinfo (data1, PM_PKG_VERSION));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Local version up to date"),
_(str)) == GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -541,7 +546,7 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
str = g_strdup_printf ("Archive %s is corrupted. Do you want to delete it?",
(char*)pacman_pkg_getinfo (data1, PM_PKG_NAME),
(char*)pacman_pkg_getinfo (data1, PM_PKG_VERSION));
- if (gfpm_question(_(str)) == GTK_RESPONSE_YES)
+ if (gfpm_question(_("Package corrupted"), _(str)) ==
GTK_RESPONSE_YES)
*response = 1;
else
*response = 0;
@@ -549,4 +554,4 @@ cb_gfpm_trans_conv (unsigned char event, void *data1, void
*data2, void *data3,
}
return;
}
-
+
diff --git a/src/gfpm-messages.h b/src/gfpm-messages.h
index 6c3d674..61a617e 100644
--- a/src/gfpm-messages.h
+++ b/src/gfpm-messages.h
@@ -17,15 +17,15 @@ void gfpm_apply_dlg_show_rem_box (gboolean);
void gfpm_apply_dlg_reset (void);
void gfpm_apply_dlg_hide (void);
-void gfpm_error (const char *);
+void gfpm_error (const char *, const char *);
-void gfpm_message (const char *);
+void gfpm_message (const char *, const char *);
-gint gfpm_question (const char *);
+gint gfpm_question (const char *, const char *);
-gint gfpm_plist_question (const char *, GList *);
+gint gfpm_plist_question (const char *, const char *, GList *);
-void gfpm_plist_message (const char *, GtkMessageType, GList *);
+void gfpm_plist_message (const char *, const char *, GtkMessageType, GList *);
char * gfpm_input (const char *, const char *, int *);
diff --git a/src/gfpm.c b/src/gfpm.c
index 597deea..2b3c11b 100644
--- a/src/gfpm.c
+++ b/src/gfpm.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
if (!xml)
{
- gfpm_error (_("Failed to initialize interface."));
+ gfpm_error (_("Interface initialization failed"), _("Failed to
initialize interface."));
return 1;
}
@@ -61,7 +61,7 @@ main (int argc, char *argv[])
if (pacman_initialize ("/") == -1)
{
- gfpm_error (_("Failed to initialize libpacman"));
+ gfpm_error (_("Error initializing libpacman"), _("Failed to
initialize libpacman"));
return 1;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git