예제 #1
0
파일: common-views.c 프로젝트: Mortal/claws
void vcal_view_select_event (const gchar *uid, FolderItem *item, gboolean edit,
		    	    GCallback block_cb, gpointer block_data)
{
	if (edit) {
    		VCalEvent *event = NULL;
        	event = vcal_manager_load_event(uid);
		if (event) {
			vcal_meeting_create(event);
			vcal_manager_free_event(event);
        	}
	} else {
        	SummaryView *summaryview = NULL;
		if (mainwindow_get_mainwindow()) {
		   MsgInfo *info = folder_item_get_msginfo_by_msgid(item, uid);
		   if (info) {
			   summaryview = mainwindow_get_mainwindow()->summaryview;
			   g_signal_handlers_block_by_func(G_OBJECT(summaryview->ctree),
					       G_CALLBACK(block_cb), block_data);
			   summary_select_by_msgnum(summaryview, info->msgnum);
			   summary_display_msg_selected(summaryview, FALSE);
			   procmsg_msginfo_free(&info);
			   g_signal_handlers_unblock_by_func(G_OBJECT(summaryview->ctree),
					       G_CALLBACK(block_cb), block_data);
		   }
		}
	}
}
예제 #2
0
static void apply_popup_delete_all (GtkAction *action, gpointer data)
{
	GSList *cur, *tags;
	GtkTreeModel *model;
	SummaryView *summaryview = NULL;
	
	if (alertpanel(_("Delete all tags"),
		       _("Do you really want to delete all tags?"),
		       GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL,
					 ALERTFOCUS_FIRST) != G_ALERTALTERNATE)
		return;

	APPLYWINDOW_LOCK();

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(applywindow.taglist));
	gtk_list_store_clear(GTK_LIST_STORE(model));

	if (mainwindow_get_mainwindow() != NULL)
		summaryview = mainwindow_get_mainwindow()->summaryview;
	cur = tags = tags_get_list();
	for (; cur; cur = cur->next) {
		gint id = GPOINTER_TO_INT(cur->data);
		if (summaryview)
			summary_set_tag(summaryview, -id, NULL);
		tags_remove_tag(id);
	}
	g_slist_free(tags);
	tags_write_tags();

	APPLYWINDOW_UNLOCK();
}
예제 #3
0
파일: logwindow.c 프로젝트: Mortal/claws
static void log_window_clip(LogWindow *logwin, guint clip_length)
{
        guint length;
	guint point;
	GtkTextBuffer *textbuf = logwin->buffer;
	GtkTextIter start_iter, end_iter;
	
	length = gtk_text_buffer_get_line_count(textbuf);
	/* debug_print("Log window length: %u\n", length); */
	
	if (length > clip_length) {
	        /* find the end of the first line after the cut off
		 * point */
       	        point = length - clip_length;
		gtk_text_buffer_get_iter_at_line(textbuf, &end_iter, point);
		if (!gtk_text_iter_forward_to_line_end(&end_iter))
			return;
		gtk_text_buffer_get_start_iter(textbuf, &start_iter);
		gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
		if (logwin->has_error) {
			gtk_text_buffer_get_start_iter(textbuf, &start_iter);
			if (mainwindow_get_mainwindow() && !gtk_text_iter_forward_to_tag_toggle(&start_iter, logwin->error_tag)) {
				mainwindow_clear_error(mainwindow_get_mainwindow());
				logwin->has_error = FALSE;
			}
		}
	}
}
예제 #4
0
static void apply_window_add_tag(void)
{
	gchar *new_tag = gtk_editable_get_chars(GTK_EDITABLE(applywindow.add_entry), 0, -1);
	g_strstrip(new_tag);
	if (new_tag && *new_tag) {
		gint id;
		FindTagInStore fis;
		if (!(IS_NOT_RESERVED_TAG(new_tag))) {
			alertpanel_error(_("You entered a reserved tag name, please choose another instead."));
			g_free(new_tag);
			return;
		}
		id = tags_get_id_for_str(new_tag);
		APPLYWINDOW_LOCK();
		if (id == -1) {
			id = tags_add_tag(new_tag);
			tags_write_tags();
			if (mainwindow_get_mainwindow())
				summary_set_tag(
					mainwindow_get_mainwindow()->summaryview, 
					id, NULL);
			main_window_reflect_tags_changes(mainwindow_get_mainwindow());
			apply_window_list_view_insert_tag(applywindow.taglist, NULL, id);
		} 
		fis.tag_id = id;
		fis.path = NULL;
		gtk_tree_model_foreach(gtk_tree_view_get_model
				(GTK_TREE_VIEW(applywindow.taglist)), 
				(GtkTreeModelForeachFunc) find_tag_in_store,
			       	&fis);
		if (fis.path) {
			GtkTreeSelection *selection;
			GtkTreePath* path;
			GtkTreeModel *model = gtk_tree_view_get_model(
				GTK_TREE_VIEW(applywindow.taglist));

			if (mainwindow_get_mainwindow())
				summary_set_tag(
					mainwindow_get_mainwindow()->summaryview, 
					id, NULL);
			selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(applywindow.taglist));
			gtk_tree_selection_select_iter(selection, &fis.iter);
			path = gtk_tree_model_get_path(model, &fis.iter);
			/* XXX returned path may not be valid??? create new one to be sure */ 
			gtk_tree_view_set_cursor(GTK_TREE_VIEW(applywindow.taglist), path, NULL, FALSE);
			apply_window_list_view_insert_tag(applywindow.taglist, &fis.iter, id);
			gtk_tree_path_free(path);
		}
		APPLYWINDOW_UNLOCK();
	} else {
		alertpanel_error(_("Tag is not set."));
	}
	g_free(new_tag);
}
예제 #5
0
static void tag_apply_selected_edited(GtkCellRendererText *widget,
		gchar *path, gchar *new_text,
		GtkWidget *list_view)
{
	GtkTreeIter iter;
	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list_view));
	gpointer tmp;
	gint tag_id;
	SummaryView *summaryview = NULL;
	gboolean selected;

	if (applywindow.busy)
		return;

	if (mainwindow_get_mainwindow() != NULL)
		summaryview = mainwindow_get_mainwindow()->summaryview;

	if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
		return;

	if (!new_text || !*new_text)
		return;

	gtk_tree_model_get(model, &iter,
			   TAG_SELECTED, &selected,
			   TAG_DATA, &tmp,
			   -1);

	tag_id = GPOINTER_TO_INT(tmp);
	
	APPLYWINDOW_LOCK();
	if (selected) {
		if (summaryview)
			summary_set_tag(summaryview, -tag_id, NULL);
	}
	
	tags_update_tag(tag_id, new_text);
	
	gtk_list_store_set(GTK_LIST_STORE(model), &iter,
			   TAG_NAME, new_text,
			   -1);
	if (selected) {
		if (summaryview)
			summary_set_tag(summaryview, tag_id, NULL);
	} else  {
		if (summaryview)
			summary_set_tag(summaryview, 0, NULL);
	}	
	APPLYWINDOW_UNLOCK();
}
예제 #6
0
static gboolean notification_popup_button(GtkWidget *widget,
					  GdkEventButton *event,
					  gpointer data)
{
  if(event->type == GDK_BUTTON_PRESS) {
    if(event->button == 1) {
      MainWindow *mainwin;
      /* Let mainwindow pop up */
      mainwin = mainwindow_get_mainwindow();
      if(!mainwin)
	return TRUE;
      notification_show_mainwindow(mainwin);
      /* If there is only one new mail message, jump to this message */
      if(popup.count == 1) {
	gchar *select_str;
	G_LOCK(popup);
	select_str = g_strdup(popup.msg_path);
	G_UNLOCK(popup);
	debug_print("Select message %s\n", select_str);
	mainwindow_jump_to(select_str, FALSE);
	g_free(select_str);
      }
    }
  }
  return TRUE;
}
예제 #7
0
static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item)
{
	MainWindow *mainwin = mainwindow_get_mainwindow();
	
#define SET_SENS(name, sens) \
	cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens)

	SET_SENS("FolderViewPopup/Subscribe", 
			folder_item_parent(item) == NULL 
			&& mainwin->lock_count == 0
			&& news_folder_locked(item->folder) == 0);
	SET_SENS("FolderViewPopup/Unsubscribe",     
			folder_item_parent(item) != NULL 
			&& mainwin->lock_count == 0
			&& news_folder_locked(item->folder) == 0);
	SET_SENS("FolderViewPopup/CheckNewMessages",    
			folder_item_parent(item) == NULL 
			&& mainwin->lock_count == 0
			&& news_folder_locked(item->folder) == 0);
	SET_SENS("FolderViewPopup/Synchronise",    
			item ? (folder_item_parent(item) != NULL
			&& folder_want_synchronise(item->folder))
			: FALSE);
	SET_SENS("FolderViewPopup/DownloadMessages",
			item ? (folder_item_parent(item) != NULL
			&& !item->no_select)
			: FALSE);
	SET_SENS("FolderViewPopup/RenameFolder",
			folder_item_parent(item) != NULL 
			&& mainwin->lock_count == 0
			&& news_folder_locked(item->folder) == 0);
#undef SET_SENS
}
예제 #8
0
파일: inc.c 프로젝트: mrvdb/claws-mail
void inc_pop_before_smtp(PrefsAccount *acc)
{
	IncProgressDialog *inc_dialog;
	IncSession *session;
	MainWindow *mainwin;

	mainwin = mainwindow_get_mainwindow();

    	session = inc_session_new(acc);
    	if (!session) return;
	POP3_SESSION(session->session)->pop_before_smtp = TRUE;
		
    	inc_dialog = inc_progress_dialog_create(FALSE);
    	inc_dialog->queue_list = g_list_append(inc_dialog->queue_list,
					       session);
	/* FIXME: assumes to attach to first main window */
	inc_dialog->mainwin = mainwin;
	inc_progress_dialog_set_list(inc_dialog);

	if (mainwin) {
		toolbar_main_set_sensitive(mainwin);
		main_window_set_menu_sensitive(mainwin);
	}
			
	inc_start(inc_dialog);
}
예제 #9
0
static void create_mainwindow_menus_and_items(GSList *filenames, gint num_entries)
{
  MainWindow *mainwin;
  gint ii;
  GSList *walk;
  GtkActionEntry *entries;

  /* create menu items */
  entries = g_new0(GtkActionEntry, num_entries);
  ii = 0;
  mainwin =  mainwindow_get_mainwindow();
  for(walk = filenames; walk; walk = walk->next) {
    entries[ii].name = g_strconcat(PYTHON_SCRIPTS_ACTION_PREFIX, walk->data, NULL);
    entries[ii].label = walk->data;
    entries[ii].callback = G_CALLBACK(python_mainwin_script_callback);
    gtk_action_group_add_actions(mainwin->action_group, &(entries[ii]), 1, (gpointer)entries[ii].name);
    ii++;
  }
  for(ii = 0; ii < num_entries; ii++) {
    guint id;

    python_mainwin_scripts_names = g_slist_prepend(python_mainwin_scripts_names, g_strdup(entries[ii].label));
    MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/" PYTHON_SCRIPTS_ACTION_PREFIX, entries[ii].label,
        entries[ii].name, GTK_UI_MANAGER_MENUITEM, id)
    python_mainwin_scripts_id_list = g_slist_prepend(python_mainwin_scripts_id_list, GUINT_TO_POINTER(id));

    prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, "Python", entries[ii].label, mainwin_toolbar_callback, NULL);
  }

  g_free(entries);
}
예제 #10
0
static void notification_trayicon_popup_default_action_cb(NotifyNotification
							  *notification,
							  const char *action,
							  void *user_data)
{
  if(strcmp("default", action))
    return;

  MainWindow *mainwin;
  mainwin = mainwindow_get_mainwindow();
  if(mainwin) {
    NotificationFolderType nftype;

    /* Let mainwindow pop up */
    notification_show_mainwindow(mainwin);
    /* If there is only one new mail message, jump to this message */
    nftype = (NotificationFolderType)GPOINTER_TO_INT(user_data);
    if((popup.count == 1) && (nftype == F_TYPE_MAIL)) {
      gchar *select_str;
      G_LOCK(trayicon_popup);
      select_str = g_strdup(popup.msg_path);
      G_UNLOCK(trayicon_popup);
      debug_print("Notification plugin: Select message %s\n", select_str);
      mainwindow_jump_to(select_str, FALSE);
      g_free(select_str);
    }
  }
}
예제 #11
0
void statusbar_progress_all (gint done, gint total, gint step) 
{
	GtkProgressBar *progressbar = GTK_PROGRESS_BAR(
					mainwindow_get_mainwindow()->progressbar);
	gchar buf[32];
	
	if (total && done % step == 0) {
#ifdef GENERIC_UMPC
		/* use a more compact format */
		const gchar *format = "%d/%d";
#else
		const gchar *format = "%d / %d";
#endif
		g_snprintf(buf, sizeof(buf), format, done, total);
		gtk_progress_bar_set_text(progressbar, buf);
		gtk_progress_bar_set_fraction(progressbar,
			 (gfloat)done / (gfloat)total);
		if (!gtk_widget_get_visible(GTK_WIDGET(progressbar)))
			gtk_widget_show(GTK_WIDGET(progressbar));
	} else if (total == 0) {
		gtk_progress_bar_set_text(progressbar, "");
		gtk_progress_bar_set_fraction(progressbar, 0.0);
		gtk_widget_hide(GTK_WIDGET(progressbar));
	}
}
예제 #12
0
static gint send_send_data_progressive(Session *session, guint cur_len,
				       guint total_len, gpointer data)
{
	gchar buf[BUFFSIZE];
	SendProgressDialog *dialog = (SendProgressDialog *)data;
	MainWindow *mainwin = mainwindow_get_mainwindow();
	
	cm_return_val_if_fail(dialog != NULL, -1);

	if (SMTP_SESSION(session)->state != SMTP_SEND_DATA &&
	    SMTP_SESSION(session)->state != SMTP_EOM)
		return 0;

	g_snprintf(buf, sizeof(buf), _("Sending message (%d / %d bytes)"),
		   cur_len, total_len);
	progress_dialog_set_label(dialog->dialog, buf);
	progress_dialog_set_fraction
		(dialog->dialog, (total_len == 0) ? 0 : (gfloat)cur_len / (gfloat)total_len);

	if (mainwin) {
		if (!gtk_widget_get_visible(mainwin->progressbar))	
			gtk_widget_show(mainwin->progressbar);
		gtk_progress_bar_set_fraction
			(GTK_PROGRESS_BAR(mainwin->progressbar),
			 (total_len == 0) ? 0 : (gfloat)cur_len / (gfloat)total_len);
	}

	return 0;
}
예제 #13
0
static void notification_trayicon_on_popup_menu(GtkStatusIcon *status_icon,
						guint button, guint activate_time,
						gpointer user_data)
{
  MainWindow *mainwin = mainwindow_get_mainwindow();

  if(!mainwin)
    return;

  /* tell callbacks to skip any event */
  updating_menu = TRUE;
  /* initialize checkitems according to current states */
	cm_toggle_menu_set_active("SysTrayiconPopup/ToggleOffline", prefs_common_get_prefs()->work_offline);
#ifdef HAVE_LIBNOTIFY
	cm_toggle_menu_set_active("SysTrayiconPopup/ShowBubbles", notify_config.trayicon_popup_enabled);
#endif
	cm_menu_set_sensitive("SysTrayiconPopup/GetMail", mainwin->lock_count == 0);

  updating_menu = FALSE;

#ifndef G_OS_WIN32
  gtk_menu_popup(GTK_MENU(traymenu_popup), NULL, NULL, NULL, NULL,
		 button, activate_time);
#else
  /* http://bugzilla.gnome.org/show_bug.cgi?id=552642 */
  gtk_menu_popup(GTK_MENU(traymenu_popup), NULL, NULL, NULL, NULL,
		 0, activate_time);
#endif
}
예제 #14
0
static void browse_python_scripts_dir(GtkAction *action, gpointer data)
{
  gchar *uri;
  GdkAppLaunchContext *launch_context;
  GError *error = NULL;
  MainWindow *mainwin;

  mainwin =  mainwindow_get_mainwindow();
  if(!mainwin) {
      debug_print("Browse Python scripts: Problems getting the mainwindow\n");
      return;
  }
  launch_context = gdk_app_launch_context_new();
  gdk_app_launch_context_set_screen(launch_context, gtk_widget_get_screen(mainwin->window));
  uri = g_strconcat("file://", get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, NULL);
  g_app_info_launch_default_for_uri(uri, G_APP_LAUNCH_CONTEXT(launch_context), &error);

  if(error) {
      debug_print("Could not open scripts dir browser: '%s'\n", error->message);
      g_error_free(error);
  }

  g_object_unref(launch_context);
  g_free(uri);
}
예제 #15
0
파일: common-views.c 프로젝트: Mortal/claws
void vcal_view_set_summary_page(GtkWidget *to_remove, guint selsig)
{
    SummaryView *summaryview = NULL;
    if (mainwindow_get_mainwindow()) {
	summaryview = mainwindow_get_mainwindow()->summaryview;
        if (selsig)
        	g_signal_handler_disconnect(G_OBJECT(summaryview->ctree), selsig);
	gtk_container_remove(GTK_CONTAINER(summaryview->mainwidget_book),
		to_remove);
	gtk_notebook_set_current_page(GTK_NOTEBOOK(summaryview->mainwidget_book),
		gtk_notebook_page_num(GTK_NOTEBOOK(summaryview->mainwidget_book), 
		summaryview->scrolledwin));
	main_window_set_menu_sensitive(mainwindow_get_mainwindow());
	toolbar_main_set_sensitive(mainwindow_get_mainwindow());
    }
	
}
예제 #16
0
static void trayicon_exit_cb(GtkAction *action, gpointer data)
{
  MainWindow *mainwin = mainwindow_get_mainwindow();

  if(mainwin->lock_count == 0) {
    app_exit_cb(mainwin, 0, NULL);
  }
}
예제 #17
0
static void trayicon_toggle_offline_cb(GtkAction *action, gpointer data)
{
  /* toggle offline mode if menu checkitem has been clicked */
  if(!updating_menu) {
    MainWindow *mainwin = mainwindow_get_mainwindow();
    main_window_toggle_work_offline(mainwin, !prefs_common_get_prefs()->work_offline, TRUE);
  }
}
예제 #18
0
파일: common-views.c 프로젝트: Mortal/claws
gint vcal_view_set_calendar_page(GtkWidget *to_show, GCallback cb, gpointer data)
{
    SummaryView *summaryview = NULL;
    gint selsig = -1;
    if (mainwindow_get_mainwindow()) {
	summaryview = mainwindow_get_mainwindow()->summaryview;
	gtk_container_add(GTK_CONTAINER(summaryview->mainwidget_book),
		to_show);
	gtk_notebook_set_current_page(GTK_NOTEBOOK(summaryview->mainwidget_book),
		gtk_notebook_page_num(GTK_NOTEBOOK(summaryview->mainwidget_book), 
		to_show));
	main_window_set_menu_sensitive(mainwindow_get_mainwindow());
	toolbar_main_set_sensitive(mainwindow_get_mainwindow());
	selsig = g_signal_connect(G_OBJECT(summaryview->ctree), "tree_select_row",
			 G_CALLBACK(cb), data);
    }
    return selsig;
}
예제 #19
0
static gboolean python_console_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
  MainWindow *mainwin;
  GtkToggleAction *action;

  mainwin =  mainwindow_get_mainwindow();
  action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(mainwin->action_group, "Tools/ShowPythonConsole"));
  gtk_toggle_action_set_active(action, FALSE);
  return TRUE;
}
예제 #20
0
static void apply_popup_delete (GtkAction *action, gpointer data)
{
	GtkTreeIter sel;
	GtkTreeModel *model;
	gint id;
	SummaryView *summaryview = NULL;
	GtkTreeSelection *selection = gtk_tree_view_get_selection
				(GTK_TREE_VIEW(applywindow.taglist));
	model = gtk_tree_view_get_model(GTK_TREE_VIEW(applywindow.taglist));

	if (!gtk_tree_selection_get_selected(selection, NULL, &sel))
		return;

	if (alertpanel(_("Delete tag"),
		       _("Do you really want to delete this tag?"),
		       GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL,
					 ALERTFOCUS_FIRST) != G_ALERTALTERNATE)
		return;

	APPLYWINDOW_LOCK();

	/* XXX: Here's the reason why we need to store the original 
	 * pointer: we search the slist for it. */
	gtk_tree_model_get(model, &sel,
			   TAG_DATA, &id,
			   -1);

	/* Even though this is not documented, gtk_tree_model_get()
	 * seems to invalidate the GtkTreeIter that is passed to it,
	 * so we need to reacquire it. */
	if (!gtk_tree_selection_get_selected(selection, NULL, &sel))
		return;

	gtk_list_store_remove(GTK_LIST_STORE(model), &sel);
	if (mainwindow_get_mainwindow() != NULL)
		summaryview = mainwindow_get_mainwindow()->summaryview;
	if (summaryview)
		summary_set_tag(summaryview, -id, NULL);
	tags_remove_tag(id);
	tags_write_tags();
	APPLYWINDOW_UNLOCK();
}
예제 #21
0
파일: plugin_gtk.c 프로젝트: twolife/claws
void plugin_gtk_done(void)
{
	MainWindow *mainwin = mainwindow_get_mainwindow();
	
	if (mainwin == NULL || claws_is_exiting())
		return;

	folderview_unregister_popup(&claws_mailmbox_popup);

	MENUITEM_REMUI_MANAGER(mainwin->ui_manager,mainwin->action_group, "File/AddMailbox/Mbox", main_menu_id);
	main_menu_id = 0;
}
예제 #22
0
void notification_trayicon_on_activate(GtkStatusIcon *status_icon, gpointer user_data)
{
  MainWindow *mainwin = mainwindow_get_mainwindow();

  if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)) == TRUE)
    focused_widget = gtk_window_get_focus(GTK_WINDOW(mainwin->window));

  notification_toggle_hide_show_window();

  if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)) == TRUE)
    gtk_window_set_focus(GTK_WINDOW(mainwin->window), focused_widget);
}
예제 #23
0
static void tag_apply_selected_toggled(GtkCellRendererToggle *widget,
		gchar *path,
		GtkWidget *list_view)
{
	GtkTreeIter iter;
	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list_view));
	gboolean enabled = TRUE, set = FALSE;
	gpointer tmp;
	gint tag_id;
	SummaryView *summaryview = NULL;

	if (applywindow.busy)
		return;

	if (mainwindow_get_mainwindow() != NULL)
		summaryview = mainwindow_get_mainwindow()->summaryview;

	if (!gtk_tree_model_get_iter_from_string(model, &iter, path))
		return;

	gtk_tree_model_get(model, &iter,
			   TAG_SELECTED, &enabled,
			   TAG_DATA, &tmp,
			   -1);

	set = !enabled;
	tag_id = GPOINTER_TO_INT(tmp);

	gtk_list_store_set(GTK_LIST_STORE(model), &iter,
			   TAG_SELECTED, set,
			   TAG_SELECTED_INCONSISTENT, FALSE,
			   -1);
	
	APPLYWINDOW_LOCK();
	if (summaryview)
		summary_set_tag(summaryview, set ? tag_id : -tag_id, NULL);
	APPLYWINDOW_UNLOCK();
}
예제 #24
0
파일: plugin_gtk.c 프로젝트: twolife/claws
gint plugin_gtk_init(gchar **error)
{
	MainWindow *mainwin = mainwindow_get_mainwindow();

	folderview_register_popup(&claws_mailmbox_popup);

	gtk_action_group_add_actions(mainwin->action_group, mainwindow_add_mailbox,
			1, (gpointer)mainwin);
	MENUITEM_ADDUI_ID_MANAGER(mainwin->ui_manager, "/Menu/File/AddMailbox", "Mbox", 
			  "File/AddMailbox/Mbox", GTK_UI_MANAGER_MENUITEM,
			  main_menu_id)

	return 0;
}
예제 #25
0
static void unsubscribe_newsgroup_cb(GtkAction *action, gpointer data)
{
	FolderView *folderview = (FolderView *)data;
	FolderItem *item;
	gchar *name;
	gchar *message;
	gchar *old_id;
	AlertValue avalue;
	MainWindow *mainwin = mainwindow_get_mainwindow();
	
	if (!folderview->selected) return;

	item = folderview_get_selected_item(folderview);
	cm_return_if_fail(item != NULL);

	if (mainwin->lock_count || news_folder_locked(item->folder))
		return;

	cm_return_if_fail(item->folder != NULL);
	cm_return_if_fail(FOLDER_TYPE(item->folder) == F_NEWS);
	cm_return_if_fail(item->folder->account != NULL);

	old_id = folder_item_get_identifier(item);

	name = trim_string(item->path, 32);
	message = g_strdup_printf(_("Really unsubscribe newsgroup '%s'?"), name);
	avalue = alertpanel_full(_("Unsubscribe newsgroup"), message,
		 	         GTK_STOCK_CANCEL, _("_Unsubscribe"), NULL,
							 ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING);
	g_free(message);
	g_free(name);
	if (avalue != G_ALERTALTERNATE) return;

	if (item == folderview_get_opened_item(folderview)) {
		summary_clear_all(folderview->summaryview);
		folderview_close_opened(folderview, TRUE);
	}

	if(item->folder->klass->remove_folder(item->folder, item) < 0) {
		folder_item_scan(item);
		alertpanel_error(_("Can't remove the folder '%s'."), name);
		g_free(old_id);
		return;
	}
	
	folder_write_list();
	
	prefs_filtering_delete_path(old_id);
	g_free(old_id);
}
예제 #26
0
static void apply_window_close(void) 
{
	if (applywindow.busy)
		return;

	if (applywindow.msglist)
		g_slist_free(applywindow.msglist);
	applywindow.msglist = NULL;
	APPLYWINDOW_LOCK();
	main_window_reflect_tags_changes(mainwindow_get_mainwindow());
	APPLYWINDOW_UNLOCK();
	apply_window_list_view_clear_tags(applywindow.taglist);
	gtk_widget_hide(applywindow.window);
	gtk_window_set_modal(GTK_WINDOW(applywindow.window), FALSE);
}
예제 #27
0
gboolean notification_trayicon_main_window_got_iconified(gpointer source,
							 gpointer data)
{
  MainWindow *mainwin = mainwindow_get_mainwindow();

  if(!notify_config.trayicon_enabled)
    return FALSE;

  if(notify_config.trayicon_hide_when_iconified &&
     mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window))
     && !gtk_window_get_skip_taskbar_hint(GTK_WINDOW(mainwin->window))) {
    gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mainwin->window), TRUE);
  }
  return FALSE;
}
예제 #28
0
static gint send_send_data_finished(Session *session, guint len, gpointer data)
{
	SendProgressDialog *dialog = (SendProgressDialog *)data;
	MainWindow *mainwin = mainwindow_get_mainwindow();

	cm_return_val_if_fail(dialog != NULL, -1);

	send_send_data_progressive(session, len, len, dialog);
	if (mainwin) {
		gtk_widget_hide(mainwin->progressbar);
		gtk_progress_bar_set_fraction
			(GTK_PROGRESS_BAR(mainwin->progressbar),(gfloat)0);
	}

	return 0;
}
예제 #29
0
gboolean notification_trayicon_main_window_close(gpointer source, gpointer data)
{
  if(!notify_config.trayicon_enabled)
    return FALSE;

  if(source) {
    gboolean *close_allowed = (gboolean*)source;

    if(notify_config.trayicon_close_to_tray) {
      MainWindow *mainwin = mainwindow_get_mainwindow();

      *close_allowed = FALSE;
      if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
	main_window_hide(mainwin);
    }
  }
  return FALSE;
}
예제 #30
0
void notification_update_urgency_hint(void)
{
  MainWindow *mainwin;
  mainwin = mainwindow_get_mainwindow();
  if(mainwin) {
    NotificationMsgCount count;
    gboolean active;
    active = FALSE;
    if(notify_config.urgency_hint_new || notify_config.urgency_hint_unread) {
      notification_core_get_msg_count(NULL, &count);
      if(notify_config.urgency_hint_new)
        active = (active || (count.new_msgs > 0));
      if(notify_config.urgency_hint_unread)
        active = (active || (count.unread_msgs > 0));
    }
    gtk_window_set_urgency_hint(GTK_WINDOW(mainwin->window), active);
  }
}